From 1e2b5a36210a5ceff8b3f59868d8526fe1e011d1 Mon Sep 17 00:00:00 2001 From: denisdulici Date: Mon, 16 Dec 2019 12:04:27 +0300 Subject: [PATCH] updated migrations --- ...2017_09_01_000000_create_accounts_table.php | 1 + .../2017_09_01_000000_create_bills_table.php | 1 + ...17_09_01_000000_create_categories_table.php | 1 + ...017_09_01_000000_create_companies_table.php | 1 + ...17_09_01_000000_create_currencies_table.php | 1 + ...017_09_01_000000_create_customers_table.php | 1 + ...2017_09_01_000000_create_invoices_table.php | 1 + .../2017_09_01_000000_create_items_table.php | 1 + .../2017_09_01_000000_create_jobs_table.php | 4 ++-- .../2017_09_01_000000_create_modules_table.php | 1 + ...09_01_000000_create_notifications_table.php | 4 ++-- ..._01_000000_create_password_resets_table.php | 4 ++-- ...2017_09_01_000000_create_payments_table.php | 1 + ...2017_09_01_000000_create_revenues_table.php | 1 + .../2017_09_01_000000_create_roles_table.php | 2 ++ ...2017_09_01_000000_create_sessions_table.php | 4 ++-- ...2017_09_01_000000_create_settings_table.php | 4 ++-- .../2017_09_01_000000_create_taxes_table.php | 1 + ...017_09_01_000000_create_transfers_table.php | 1 + .../2017_09_01_000000_create_users_table.php | 4 ++-- .../2017_09_01_000000_create_vendors_table.php | 1 + ...7_10_11_000000_create_bill_totals_table.php | 1 + ...0_11_000000_create_invoice_totals_table.php | 1 + ...7_11_16_000000_create_failed_jobs_table.php | 1 + .../2017_12_09_000000_add_currency_columns.php | 6 ++++-- ...017_12_30_000000_create_mediable_tables.php | 4 ++-- ...p_attachment_column_bill_payments_table.php | 4 ++-- ...0000_drop_attachment_column_bills_table.php | 4 ++-- ...ttachment_column_invoice_payments_table.php | 4 ++-- ...0_drop_attachment_column_invoices_table.php | 4 ++-- ...0_drop_attachment_column_payments_table.php | 4 ++-- ...0_drop_attachment_column_revenues_table.php | 4 ++-- ..._000000_drop_picture_column_items_table.php | 4 ++-- ..._000000_drop_picture_column_users_table.php | 4 ++-- ...0000_add_category_column_invoices_bills.php | 10 ++++++---- ...018_04_26_000000_create_recurring_table.php | 1 + .../2018_04_30_000000_add_parent_column.php | 18 ++++++++++-------- .../2018_06_23_000000_modify_email_column.php | 1 + ...2018_06_30_000000_modify_enabled_column.php | 1 + .../2018_07_07_000000_modify_date_column.php | 1 + ...6_000000_add_reference_column_customers.php | 6 ++++-- ..._26_000000_add_reference_column_vendors.php | 6 ++++-- ..._22_000000_create_bill_item_taxes_table.php | 1 + ..._000000_create_invoice_item_taxes_table.php | 1 + ...2018_10_27_000000_add_reconciled_column.php | 18 ++++++++++-------- ..._27_000000_create_reconciliations_table.php | 1 + .../2018_11_05_000000_add_tax_columns.php | 6 ++++-- .../2019_01_07_000000_drop_tax_id_column.php | 4 ++-- ...00_modify_deleted_at_column_media_table.php | 1 + ...000000_add_footer_column_invoices_table.php | 6 ++++-- ...2019_11_14_000000_create_contacts_table.php | 1 + ...19_11_14_000000_create_dashboards_table.php | 1 + ..._14_000000_create_email_templates_table.php | 2 +- ...2019_11_14_000000_create_firewall_table.php | 1 + .../2019_11_14_000000_create_reports_table.php | 2 +- ..._11_14_000000_create_transactions_table.php | 1 + ...00_modify_domain_column_companies_table.php | 1 + ...0000_modify_status_column_modules_table.php | 1 + ..._modify_sku_quantity_column_items_table.php | 13 ++++++++++++- ...00000_drop_enabled_column_reports_table.php | 2 +- .../2020_01_01_000000_add_locale_column.php | 6 ++++-- 61 files changed, 130 insertions(+), 68 deletions(-) diff --git a/database/migrations/2017_09_01_000000_create_accounts_table.php b/database/migrations/2017_09_01_000000_create_accounts_table.php index d95bc1b98..e69227598 100644 --- a/database/migrations/2017_09_01_000000_create_accounts_table.php +++ b/database/migrations/2017_09_01_000000_create_accounts_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateAccountsTable extends Migration { diff --git a/database/migrations/2017_09_01_000000_create_bills_table.php b/database/migrations/2017_09_01_000000_create_bills_table.php index 2ba4376fb..6947f7754 100644 --- a/database/migrations/2017_09_01_000000_create_bills_table.php +++ b/database/migrations/2017_09_01_000000_create_bills_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateBillsTable extends Migration { diff --git a/database/migrations/2017_09_01_000000_create_categories_table.php b/database/migrations/2017_09_01_000000_create_categories_table.php index 82a1a2ccf..a548417c3 100644 --- a/database/migrations/2017_09_01_000000_create_categories_table.php +++ b/database/migrations/2017_09_01_000000_create_categories_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateCategoriesTable extends Migration { diff --git a/database/migrations/2017_09_01_000000_create_companies_table.php b/database/migrations/2017_09_01_000000_create_companies_table.php index 970129d99..23847b18a 100644 --- a/database/migrations/2017_09_01_000000_create_companies_table.php +++ b/database/migrations/2017_09_01_000000_create_companies_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateCompaniesTable extends Migration { diff --git a/database/migrations/2017_09_01_000000_create_currencies_table.php b/database/migrations/2017_09_01_000000_create_currencies_table.php index 49ca90f60..33584837a 100644 --- a/database/migrations/2017_09_01_000000_create_currencies_table.php +++ b/database/migrations/2017_09_01_000000_create_currencies_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateCurrenciesTable extends Migration { diff --git a/database/migrations/2017_09_01_000000_create_customers_table.php b/database/migrations/2017_09_01_000000_create_customers_table.php index 0a65a5174..d0840d783 100644 --- a/database/migrations/2017_09_01_000000_create_customers_table.php +++ b/database/migrations/2017_09_01_000000_create_customers_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateCustomersTable extends Migration { diff --git a/database/migrations/2017_09_01_000000_create_invoices_table.php b/database/migrations/2017_09_01_000000_create_invoices_table.php index 123a2f850..4ad4ec570 100644 --- a/database/migrations/2017_09_01_000000_create_invoices_table.php +++ b/database/migrations/2017_09_01_000000_create_invoices_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateInvoicesTable extends Migration { diff --git a/database/migrations/2017_09_01_000000_create_items_table.php b/database/migrations/2017_09_01_000000_create_items_table.php index d76144ae8..2ad69782e 100644 --- a/database/migrations/2017_09_01_000000_create_items_table.php +++ b/database/migrations/2017_09_01_000000_create_items_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateItemsTable extends Migration { diff --git a/database/migrations/2017_09_01_000000_create_jobs_table.php b/database/migrations/2017_09_01_000000_create_jobs_table.php index ae05432ad..bbd1f7f7c 100644 --- a/database/migrations/2017_09_01_000000_create_jobs_table.php +++ b/database/migrations/2017_09_01_000000_create_jobs_table.php @@ -1,8 +1,8 @@ string('precision')->nullable(); $table->string('symbol')->nullable(); $table->integer('symbol_first')->default(1); @@ -27,7 +29,7 @@ class AddCurrencyColumns extends Migration */ public function down() { - Schema::table('currencies', function ($table) { + Schema::table('currencies', function (Blueprint $table) { $table->dropColumn([ 'precision', 'symbol', diff --git a/database/migrations/2017_12_30_000000_create_mediable_tables.php b/database/migrations/2017_12_30_000000_create_mediable_tables.php index ec7ed0c2c..b297bb751 100644 --- a/database/migrations/2017_12_30_000000_create_mediable_tables.php +++ b/database/migrations/2017_12_30_000000_create_mediable_tables.php @@ -1,8 +1,8 @@ integer('category_id')->default(); }); - Schema::table('bills', function ($table) { + Schema::table('bills', function (Blueprint $table) { $table->integer('category_id')->default(); }); } @@ -27,11 +29,11 @@ class AddCategoryColumnInvoicesBills extends Migration */ public function down() { - Schema::table('invoices', function ($table) { + Schema::table('invoices', function (Blueprint $table) { $table->dropColumn('category_id'); }); - Schema::table('bills', function ($table) { + Schema::table('bills', function (Blueprint $table) { $table->dropColumn('category_id'); }); } diff --git a/database/migrations/2018_04_26_000000_create_recurring_table.php b/database/migrations/2018_04_26_000000_create_recurring_table.php index 0057ca08d..4c87cda84 100644 --- a/database/migrations/2018_04_26_000000_create_recurring_table.php +++ b/database/migrations/2018_04_26_000000_create_recurring_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateRecurringTable extends Migration { diff --git a/database/migrations/2018_04_30_000000_add_parent_column.php b/database/migrations/2018_04_30_000000_add_parent_column.php index 89ba2776a..b12e3fe8c 100644 --- a/database/migrations/2018_04_30_000000_add_parent_column.php +++ b/database/migrations/2018_04_30_000000_add_parent_column.php @@ -1,6 +1,8 @@ integer('parent_id')->default(0); }); - Schema::table('revenues', function ($table) { + Schema::table('revenues', function (Blueprint $table) { $table->integer('parent_id')->default(0); }); - Schema::table('bills', function ($table) { + Schema::table('bills', function (Blueprint $table) { $table->integer('parent_id')->default(0); }); - Schema::table('payments', function ($table) { + Schema::table('payments', function (Blueprint $table) { $table->integer('parent_id')->default(0); }); } @@ -35,19 +37,19 @@ class AddParentColumn extends Migration */ public function down() { - Schema::table('invoices', function ($table) { + Schema::table('invoices', function (Blueprint $table) { $table->dropColumn('parent_id'); }); - Schema::table('revenues', function ($table) { + Schema::table('revenues', function (Blueprint $table) { $table->dropColumn('parent_id'); }); - Schema::table('bills', function ($table) { + Schema::table('bills', function (Blueprint $table) { $table->dropColumn('parent_id'); }); - Schema::table('payments', function ($table) { + Schema::table('payments', function (Blueprint $table) { $table->dropColumn('parent_id'); }); } diff --git a/database/migrations/2018_06_23_000000_modify_email_column.php b/database/migrations/2018_06_23_000000_modify_email_column.php index 7fefdb8c2..9aa8f1719 100644 --- a/database/migrations/2018_06_23_000000_modify_email_column.php +++ b/database/migrations/2018_06_23_000000_modify_email_column.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class ModifyEmailColumn extends Migration { diff --git a/database/migrations/2018_06_30_000000_modify_enabled_column.php b/database/migrations/2018_06_30_000000_modify_enabled_column.php index aaf5fb8eb..992ea360b 100644 --- a/database/migrations/2018_06_30_000000_modify_enabled_column.php +++ b/database/migrations/2018_06_30_000000_modify_enabled_column.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class ModifyEnabledColumn extends Migration { diff --git a/database/migrations/2018_07_07_000000_modify_date_column.php b/database/migrations/2018_07_07_000000_modify_date_column.php index 0e0125a93..9c9505c3c 100644 --- a/database/migrations/2018_07_07_000000_modify_date_column.php +++ b/database/migrations/2018_07_07_000000_modify_date_column.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class ModifyDateColumn extends Migration { diff --git a/database/migrations/2018_09_26_000000_add_reference_column_customers.php b/database/migrations/2018_09_26_000000_add_reference_column_customers.php index ee4a2bda4..550dd9c8a 100644 --- a/database/migrations/2018_09_26_000000_add_reference_column_customers.php +++ b/database/migrations/2018_09_26_000000_add_reference_column_customers.php @@ -1,6 +1,8 @@ string('reference')->nullable(); }); } @@ -23,7 +25,7 @@ class AddReferenceColumnCustomers extends Migration */ public function down() { - Schema::table('customers', function ($table) { + Schema::table('customers', function (Blueprint $table) { $table->dropColumn('reference'); }); } diff --git a/database/migrations/2018_09_26_000000_add_reference_column_vendors.php b/database/migrations/2018_09_26_000000_add_reference_column_vendors.php index 168647908..49fea58e5 100644 --- a/database/migrations/2018_09_26_000000_add_reference_column_vendors.php +++ b/database/migrations/2018_09_26_000000_add_reference_column_vendors.php @@ -1,6 +1,8 @@ string('reference')->nullable(); }); } @@ -23,7 +25,7 @@ class AddReferenceColumnVendors extends Migration */ public function down() { - Schema::table('vendors', function ($table) { + Schema::table('vendors', function (Blueprint $table) { $table->dropColumn('reference'); }); } diff --git a/database/migrations/2018_10_22_000000_create_bill_item_taxes_table.php b/database/migrations/2018_10_22_000000_create_bill_item_taxes_table.php index 7338aca0d..b1244eec8 100644 --- a/database/migrations/2018_10_22_000000_create_bill_item_taxes_table.php +++ b/database/migrations/2018_10_22_000000_create_bill_item_taxes_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateBillItemTaxesTable extends Migration { diff --git a/database/migrations/2018_10_22_000000_create_invoice_item_taxes_table.php b/database/migrations/2018_10_22_000000_create_invoice_item_taxes_table.php index db24d8471..5d3e42e71 100644 --- a/database/migrations/2018_10_22_000000_create_invoice_item_taxes_table.php +++ b/database/migrations/2018_10_22_000000_create_invoice_item_taxes_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateInvoiceItemTaxesTable extends Migration { diff --git a/database/migrations/2018_10_27_000000_add_reconciled_column.php b/database/migrations/2018_10_27_000000_add_reconciled_column.php index 9aa23f498..9175022d0 100644 --- a/database/migrations/2018_10_27_000000_add_reconciled_column.php +++ b/database/migrations/2018_10_27_000000_add_reconciled_column.php @@ -1,6 +1,8 @@ boolean('reconciled')->default(0); }); - Schema::table('invoice_payments', function ($table) { + Schema::table('invoice_payments', function (Blueprint $table) { $table->boolean('reconciled')->default(0); }); - Schema::table('payments', function ($table) { + Schema::table('payments', function (Blueprint $table) { $table->boolean('reconciled')->default(0); }); - Schema::table('revenues', function ($table) { + Schema::table('revenues', function (Blueprint $table) { $table->boolean('reconciled')->default(0); }); } @@ -35,19 +37,19 @@ class AddReconciledColumn extends Migration */ public function down() { - Schema::table('bill_payments', function ($table) { + Schema::table('bill_payments', function (Blueprint $table) { $table->dropColumn('reconciled'); }); - Schema::table('invoice_payments', function ($table) { + Schema::table('invoice_payments', function (Blueprint $table) { $table->dropColumn('reconciled'); }); - Schema::table('payments', function ($table) { + Schema::table('payments', function (Blueprint $table) { $table->dropColumn('reconciled'); }); - Schema::table('revenues', function ($table) { + Schema::table('revenues', function (Blueprint $table) { $table->dropColumn('reconciled'); }); } diff --git a/database/migrations/2018_10_27_000000_create_reconciliations_table.php b/database/migrations/2018_10_27_000000_create_reconciliations_table.php index 1f0fb4f13..7bc6939fe 100644 --- a/database/migrations/2018_10_27_000000_create_reconciliations_table.php +++ b/database/migrations/2018_10_27_000000_create_reconciliations_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateReconciliationsTable extends Migration { diff --git a/database/migrations/2018_11_05_000000_add_tax_columns.php b/database/migrations/2018_11_05_000000_add_tax_columns.php index 9edb97750..1e31d94a6 100644 --- a/database/migrations/2018_11_05_000000_add_tax_columns.php +++ b/database/migrations/2018_11_05_000000_add_tax_columns.php @@ -1,6 +1,8 @@ string('type')->default('normal'); }); } @@ -23,7 +25,7 @@ class AddTaxColumns extends Migration */ public function down() { - Schema::table('taxes', function ($table) { + Schema::table('taxes', function (Blueprint $table) { $table->dropColumn([ 'type', ]); diff --git a/database/migrations/2019_01_07_000000_drop_tax_id_column.php b/database/migrations/2019_01_07_000000_drop_tax_id_column.php index 3b78caa10..e8352e10a 100644 --- a/database/migrations/2019_01_07_000000_drop_tax_id_column.php +++ b/database/migrations/2019_01_07_000000_drop_tax_id_column.php @@ -1,8 +1,8 @@ text('footer')->nullable(); }); } @@ -23,7 +25,7 @@ class AddFooterColumnInvoicesTable extends Migration */ public function down() { - Schema::table('invoices', function ($table) { + Schema::table('invoices', function (Blueprint $table) { $table->dropColumn('footer'); }); } diff --git a/database/migrations/2019_11_14_000000_create_contacts_table.php b/database/migrations/2019_11_14_000000_create_contacts_table.php index 02f518129..926e866c5 100644 --- a/database/migrations/2019_11_14_000000_create_contacts_table.php +++ b/database/migrations/2019_11_14_000000_create_contacts_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateContactsTable extends Migration { diff --git a/database/migrations/2019_11_14_000000_create_dashboards_table.php b/database/migrations/2019_11_14_000000_create_dashboards_table.php index c3a9ce448..006ed1fd9 100644 --- a/database/migrations/2019_11_14_000000_create_dashboards_table.php +++ b/database/migrations/2019_11_14_000000_create_dashboards_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class CreateDashboardsTable extends Migration { diff --git a/database/migrations/2019_11_14_000000_create_email_templates_table.php b/database/migrations/2019_11_14_000000_create_email_templates_table.php index 1616169dc..95dc5a354 100644 --- a/database/migrations/2019_11_14_000000_create_email_templates_table.php +++ b/database/migrations/2019_11_14_000000_create_email_templates_table.php @@ -1,8 +1,8 @@ string('sku')->nullable()->change(); $table->integer('quantity')->default(1)->change(); - $table->dropUnique(['company_id', 'sku', 'deleted_at']); + + $connection = Schema::getConnection(); + $d_table = $connection->getDoctrineSchemaManager()->listTableDetails($connection->getTablePrefix() . 'items'); + + if ($d_table->hasIndex('items_company_id_sku_deleted_at_unique')) { + // 1.3 update + $table->dropUnique('items_company_id_sku_deleted_at_unique'); + } else { + // 2.0 install + $table->dropUnique(['company_id', 'sku', 'deleted_at']); + } }); } diff --git a/database/migrations/2019_11_19_000000_drop_enabled_column_reports_table.php b/database/migrations/2019_11_19_000000_drop_enabled_column_reports_table.php index dcf825d2c..e57b59725 100644 --- a/database/migrations/2019_11_19_000000_drop_enabled_column_reports_table.php +++ b/database/migrations/2019_11_19_000000_drop_enabled_column_reports_table.php @@ -1,8 +1,8 @@ string('locale')->default(config('app.locale')); }); } @@ -23,7 +25,7 @@ class AddLocaleColumn extends Migration */ public function down() { - Schema::table('users', function ($table) { + Schema::table('users', function (Blueprint $table) { $table->dropColumn('locale'); }); }