diff --git a/database/migrations/2020_02_01_063235_create_custom_fields_table.php b/database/migrations/2020_02_01_063235_create_custom_fields_table.php index 2d695a2b..58731642 100644 --- a/database/migrations/2020_02_01_063235_create_custom_fields_table.php +++ b/database/migrations/2020_02_01_063235_create_custom_fields_table.php @@ -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'); } } diff --git a/database/migrations/2020_02_01_063509_create_custom_field_values_table.php b/database/migrations/2020_02_01_063509_create_custom_field_values_table.php index 7701013d..c03ccc0f 100644 --- a/database/migrations/2020_02_01_063509_create_custom_field_values_table.php +++ b/database/migrations/2020_02_01_063509_create_custom_field_values_table.php @@ -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'); } } diff --git a/database/migrations/2020_05_12_154129_add_user_id_to_expenses_table.php b/database/migrations/2020_05_12_154129_add_user_id_to_expenses_table.php index 130994c1..ddb4c8e0 100644 --- a/database/migrations/2020_05_12_154129_add_user_id_to_expenses_table.php +++ b/database/migrations/2020_05_12_154129_add_user_id_to_expenses_table.php @@ -26,8 +26,6 @@ class AddUserIdToExpensesTable extends Migration */ public function down() { - Schema::table('expenses', function (Blueprint $table) { - $table->dropColumn('paid'); - }); + } } diff --git a/database/migrations/2020_10_01_102913_add_company_to_addresses_table.php b/database/migrations/2020_10_01_102913_add_company_to_addresses_table.php index 570fe919..e643a700 100644 --- a/database/migrations/2020_10_01_102913_add_company_to_addresses_table.php +++ b/database/migrations/2020_10_01_102913_add_company_to_addresses_table.php @@ -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' ] ); + } }); } } diff --git a/database/migrations/2020_11_23_050206_add_creator_in_invoices_table.php b/database/migrations/2020_11_23_050206_add_creator_in_invoices_table.php index 81fd5906..ac330667 100644 --- a/database/migrations/2020_11_23_050206_add_creator_in_invoices_table.php +++ b/database/migrations/2020_11_23_050206_add_creator_in_invoices_table.php @@ -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' ] ); + } }); } } diff --git a/database/migrations/2020_11_23_050252_add_creator_in_estimates_table.php b/database/migrations/2020_11_23_050252_add_creator_in_estimates_table.php index 59263bb2..6963e658 100644 --- a/database/migrations/2020_11_23_050252_add_creator_in_estimates_table.php +++ b/database/migrations/2020_11_23_050252_add_creator_in_estimates_table.php @@ -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' ] ); + } }); } } diff --git a/database/migrations/2020_11_23_050316_add_creator_in_payments_table.php b/database/migrations/2020_11_23_050316_add_creator_in_payments_table.php index e16cc469..ea622243 100644 --- a/database/migrations/2020_11_23_050316_add_creator_in_payments_table.php +++ b/database/migrations/2020_11_23_050316_add_creator_in_payments_table.php @@ -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' ] ); + } }); } } diff --git a/database/migrations/2020_11_23_050333_add_creator_in_expenses_table.php b/database/migrations/2020_11_23_050333_add_creator_in_expenses_table.php index 02e0fd5a..676edb80 100644 --- a/database/migrations/2020_11_23_050333_add_creator_in_expenses_table.php +++ b/database/migrations/2020_11_23_050333_add_creator_in_expenses_table.php @@ -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' ] ); + } }); } } diff --git a/database/migrations/2020_11_23_050406_add_creator_in_items_table.php b/database/migrations/2020_11_23_050406_add_creator_in_items_table.php index 5d1a8b81..d5d9d279 100644 --- a/database/migrations/2020_11_23_050406_add_creator_in_items_table.php +++ b/database/migrations/2020_11_23_050406_add_creator_in_items_table.php @@ -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' ] ); + } }); } } diff --git a/database/migrations/2020_11_23_065815_add_creator_in_users_table.php b/database/migrations/2020_11_23_065815_add_creator_in_users_table.php index 15797a10..ba3d6e9f 100644 --- a/database/migrations/2020_11_23_065815_add_creator_in_users_table.php +++ b/database/migrations/2020_11_23_065815_add_creator_in_users_table.php @@ -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' ] ); + } }); } } diff --git a/database/migrations/2021_07_06_070204_add_owner_id_to_companies_table.php b/database/migrations/2021_07_06_070204_add_owner_id_to_companies_table.php index fe241e17..677b0c6a 100644 --- a/database/migrations/2021_07_06_070204_add_owner_id_to_companies_table.php +++ b/database/migrations/2021_07_06_070204_add_owner_id_to_companies_table.php @@ -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' ] ); + } }); } } diff --git a/database/migrations/2021_07_08_110940_add_company_to_notes_table.php b/database/migrations/2021_07_08_110940_add_company_to_notes_table.php index bee0f7d2..f7e2c903 100644 --- a/database/migrations/2021_07_08_110940_add_company_to_notes_table.php +++ b/database/migrations/2021_07_08_110940_add_company_to_notes_table.php @@ -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' ] ); + } }); } } diff --git a/database/migrations/2021_07_09_063712_add_recurring_invoice_id_to_invoices_table.php b/database/migrations/2021_07_09_063712_add_recurring_invoice_id_to_invoices_table.php index bacec8d0..068d512a 100644 --- a/database/migrations/2021_07_09_063712_add_recurring_invoice_id_to_invoices_table.php +++ b/database/migrations/2021_07_09_063712_add_recurring_invoice_id_to_invoices_table.php @@ -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'); }); } diff --git a/database/migrations/2021_07_09_063755_add_recurring_invoice_id_to_invoice_items_table.php b/database/migrations/2021_07_09_063755_add_recurring_invoice_id_to_invoice_items_table.php index 063c6d34..12261049 100644 --- a/database/migrations/2021_07_09_063755_add_recurring_invoice_id_to_invoice_items_table.php +++ b/database/migrations/2021_07_09_063755_add_recurring_invoice_id_to_invoice_items_table.php @@ -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'); }); } diff --git a/database/migrations/2021_07_16_080253_add_currency_id_into_invoices_table.php b/database/migrations/2021_07_16_080253_add_currency_id_into_invoices_table.php index ad754f0d..a6f33ffa 100644 --- a/database/migrations/2021_07_16_080253_add_currency_id_into_invoices_table.php +++ b/database/migrations/2021_07_16_080253_add_currency_id_into_invoices_table.php @@ -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'); }); } diff --git a/database/migrations/2021_07_16_080508_add_currency_id_into_payments_table.php b/database/migrations/2021_07_16_080508_add_currency_id_into_payments_table.php index ae49674c..69954d12 100644 --- a/database/migrations/2021_07_16_080508_add_currency_id_into_payments_table.php +++ b/database/migrations/2021_07_16_080508_add_currency_id_into_payments_table.php @@ -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'); }); } diff --git a/database/migrations/2021_07_16_080611_add_currency_id_into_items_table.php b/database/migrations/2021_07_16_080611_add_currency_id_into_items_table.php index 370fcf9d..dea454ac 100644 --- a/database/migrations/2021_07_16_080611_add_currency_id_into_items_table.php +++ b/database/migrations/2021_07_16_080611_add_currency_id_into_items_table.php @@ -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'); }); } diff --git a/database/migrations/2021_07_16_080702_add_currency_id_into_taxes_table.php b/database/migrations/2021_07_16_080702_add_currency_id_into_taxes_table.php index d1745bb3..a1fa353c 100644 --- a/database/migrations/2021_07_16_080702_add_currency_id_into_taxes_table.php +++ b/database/migrations/2021_07_16_080702_add_currency_id_into_taxes_table.php @@ -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'); }); } diff --git a/database/migrations/2021_07_16_112429_add_currency_id_into_estimates_table.php b/database/migrations/2021_07_16_112429_add_currency_id_into_estimates_table.php index 724ff379..49fd8a0e 100644 --- a/database/migrations/2021_07_16_112429_add_currency_id_into_estimates_table.php +++ b/database/migrations/2021_07_16_112429_add_currency_id_into_estimates_table.php @@ -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'); }); } diff --git a/database/migrations/2021_08_05_103535_create_exchange_rate_logs_table.php b/database/migrations/2021_08_05_103535_create_exchange_rate_logs_table.php index 11dda3d6..c3dc9cf5 100644 --- a/database/migrations/2021_08_05_103535_create_exchange_rate_logs_table.php +++ b/database/migrations/2021_08_05_103535_create_exchange_rate_logs_table.php @@ -33,6 +33,6 @@ class CreateExchangeRateLogsTable extends Migration */ public function down() { - Schema::dropIfExists('exchange_rates'); + Schema::dropIfExists('exchange_rate_logs'); } } diff --git a/database/migrations/2021_10_06_100539_add_recurring_invoice_id_to_taxes_table.php b/database/migrations/2021_10_06_100539_add_recurring_invoice_id_to_taxes_table.php index 90da41a7..80daf59e 100644 --- a/database/migrations/2021_10_06_100539_add_recurring_invoice_id_to_taxes_table.php +++ b/database/migrations/2021_10_06_100539_add_recurring_invoice_id_to_taxes_table.php @@ -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'); }); } diff --git a/database/migrations/2021_11_13_051127_add_payment_method_to_expense_table.php b/database/migrations/2021_11_13_051127_add_payment_method_to_expense_table.php index c1fbabdb..ce0190d5 100644 --- a/database/migrations/2021_11_13_051127_add_payment_method_to_expense_table.php +++ b/database/migrations/2021_11_13_051127_add_payment_method_to_expense_table.php @@ -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'); }); } diff --git a/database/migrations/2021_12_04_123315_add_transaction_id_to_payments_table.php b/database/migrations/2021_12_04_123315_add_transaction_id_to_payments_table.php index 97b281cf..1b31e77b 100644 --- a/database/migrations/2021_12_04_123315_add_transaction_id_to_payments_table.php +++ b/database/migrations/2021_12_04_123315_add_transaction_id_to_payments_table.php @@ -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'); }); }