mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 13:41:23 +00:00
Fix database migration rollback
This commit is contained in:
@@ -43,6 +43,11 @@ class CreateCustomFieldsTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('custom_fields', function (Blueprint $table) {
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'company_id' ] );
|
||||
}
|
||||
});
|
||||
Schema::dropIfExists('custom_fields');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,12 @@ class CreateCustomFieldValuesTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('answers');
|
||||
Schema::table('custom_field_values', function (Blueprint $table){
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign(['custom_field_id']);
|
||||
$table->dropForeign(['company_id']);
|
||||
}
|
||||
});
|
||||
Schema::dropIfExists('custom_field_values');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,6 @@ class AddUserIdToExpensesTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->dropColumn('paid');
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,9 @@ class AddCompanyToAddressesTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('addresses', function (Blueprint $table) {
|
||||
$table->dropForeign(['company_id']);
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'company_id' ] );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ class AddCreatorInInvoicesTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
$table->dropForeign(['creator_id']);
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'creator_id' ] );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ class AddCreatorInEstimatesTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('estimates', function (Blueprint $table) {
|
||||
$table->dropForeign(['creator_id']);
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'creator_id' ] );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ class AddCreatorInPaymentsTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('payments', function (Blueprint $table) {
|
||||
$table->dropForeign(['creator_id']);
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'creator_id' ] );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ class AddCreatorInExpensesTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->dropForeign(['creator_id']);
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'creator_id' ] );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ class AddCreatorInItemsTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('items', function (Blueprint $table) {
|
||||
$table->dropForeign(['creator_id']);
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'creator_id' ] );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ class AddCreatorInUsersTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropForeign(['creator_id']);
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'creator_id' ] );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,9 @@ class AddOwnerIdToCompaniesTable extends Migration
|
||||
{
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->dropColumn('slug');
|
||||
$table->dropForeign(['owner_id']);
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'owner_id' ] );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,9 @@ class AddCompanyToNotesTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('notes', function (Blueprint $table) {
|
||||
$table->dropForeign(['company_id']);
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'company_id' ] );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ class AddRecurringInvoiceIdToInvoicesTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'recurring_invoice_id' ] );
|
||||
}
|
||||
$table->dropColumn('recurring_invoice_id');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@ class AddRecurringInvoiceIdToInvoiceItemsTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('invoice_items', function (Blueprint $table) {
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'recurring_invoice_id' ] );
|
||||
}
|
||||
$table->dropColumn('recurring_invoice_id');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ class AddCurrencyIdIntoInvoicesTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'currency_id' ] );
|
||||
}
|
||||
$table->dropColumn('currency_id');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ class AddCurrencyIdIntoPaymentsTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('payments', function (Blueprint $table) {
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'currency_id' ] );
|
||||
}
|
||||
$table->dropColumn('currency_id');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ class AddCurrencyIdIntoItemsTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('items', function (Blueprint $table) {
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'currency_id' ] );
|
||||
}
|
||||
$table->dropColumn('currency_id');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ class AddCurrencyIdIntoTaxesTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('taxes', function (Blueprint $table) {
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'currency_id' ] );
|
||||
}
|
||||
$table->dropColumn('currency_id');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ class AddCurrencyIdIntoEstimatesTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('estimates', function (Blueprint $table) {
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'currency_id' ] );
|
||||
}
|
||||
$table->dropColumn('currency_id');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ class CreateExchangeRateLogsTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('exchange_rates');
|
||||
Schema::dropIfExists('exchange_rate_logs');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ class AddRecurringInvoiceIdToTaxesTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('taxes', function (Blueprint $table) {
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'recurring_invoice_id' ] );
|
||||
}
|
||||
$table->dropColumn('recurring_invoice_id');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ class AddPaymentMethodToExpenseTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'payment_method_id' ] );
|
||||
}
|
||||
$table->dropColumn('payment_method_id');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ class AddTransactionIdToPaymentsTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('payments', function (Blueprint $table) {
|
||||
if (config('database.default') !== 'sqlite') {
|
||||
$table->dropForeign( [ 'transaction_id' ] );
|
||||
}
|
||||
$table->dropColumn('transaction_id');
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user