Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Update migrations so you can always roll back.
James Coleb7f0a6fff496
diff --git a/database/migrations/2016_06_16_000000_create_support_tables.php b/database/migrations/2016_06_16_000000_create_support_tables.phpindex 0adc8d6ddc..a5f0f1cad0 100644--- a/database/migrations/2016_06_16_000000_create_support_tables.php+++ b/database/migrations/2016_06_16_000000_create_support_tables.php@@ -31,7 +31,7 @@ class CreateSupportTables extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{Schema::drop('account_types');Schema::drop('transaction_currencies');@@ -50,7 +50,7 @@ class CreateSupportTables extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{$this->createAccountTypeTable();$this->createCurrencyTable();@@ -67,7 +67,7 @@ class CreateSupportTables extends Migration/****/- private function createAccountTypeTable()+ private function createAccountTypeTable(): void{if (!Schema::hasTable('account_types')) {Schema::create(@@ -84,7 +84,7 @@ class CreateSupportTables extends Migration}}- private function createConfigurationTable()+ private function createConfigurationTable(): void{if (!Schema::hasTable('configuration')) {Schema::create(@@ -104,7 +104,7 @@ class CreateSupportTables extends Migration/****/- private function createCurrencyTable()+ private function createCurrencyTable(): void{if (!Schema::hasTable('transaction_currencies')) {Schema::create(@@ -127,7 +127,7 @@ class CreateSupportTables extends Migration/****/- private function createJobsTable()+ private function createJobsTable(): void{if (!Schema::hasTable('jobs')) {Schema::create(@@ -151,7 +151,7 @@ class CreateSupportTables extends Migration/****/- private function createPasswordTable()+ private function createPasswordTable(): void{if (!Schema::hasTable('password_resets')) {Schema::create(@@ -169,7 +169,7 @@ class CreateSupportTables extends Migration/****/- private function createPermissionRoleTable()+ private function createPermissionRoleTable(): void{if (!Schema::hasTable('permission_role')) {Schema::create(@@ -190,7 +190,7 @@ class CreateSupportTables extends Migration/****/- private function createPermissionsTable()+ private function createPermissionsTable(): void{if (!Schema::hasTable('permissions')) {Schema::create(@@ -209,7 +209,7 @@ class CreateSupportTables extends Migration/****/- private function createRolesTable()+ private function createRolesTable(): void{if (!Schema::hasTable('roles')) {Schema::create(@@ -228,7 +228,7 @@ class CreateSupportTables extends Migration/****/- private function createSessionsTable()+ private function createSessionsTable(): void{if (!Schema::hasTable('sessions')) {Schema::create(@@ -248,7 +248,7 @@ class CreateSupportTables extends Migration/****/- private function createTransactionTypeTable()+ private function createTransactionTypeTable(): void{if (!Schema::hasTable('transaction_types')) {Schema::create(diff --git a/database/migrations/2016_06_16_000001_create_users_table.php b/database/migrations/2016_06_16_000001_create_users_table.phpindex 551bfa748f..14c749f908 100644--- a/database/migrations/2016_06_16_000001_create_users_table.php+++ b/database/migrations/2016_06_16_000001_create_users_table.php@@ -31,7 +31,7 @@ class CreateUsersTable extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{Schema::drop('users');}@@ -41,7 +41,7 @@ class CreateUsersTable extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{if (!Schema::hasTable('users')) {Schema::create(diff --git a/database/migrations/2016_06_16_000002_create_main_tables.php b/database/migrations/2016_06_16_000002_create_main_tables.phpindex 09e547b800..96d580a757 100644--- a/database/migrations/2016_06_16_000002_create_main_tables.php+++ b/database/migrations/2016_06_16_000002_create_main_tables.php@@ -31,7 +31,7 @@ class CreateMainTables extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{Schema::drop('account_meta');Schema::drop('piggy_bank_repetitions');@@ -68,7 +68,7 @@ class CreateMainTables extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{$this->createAccountTables();$this->createPiggyBanksTable();@@ -87,7 +87,7 @@ class CreateMainTables extends Migration/****/- private function createAccountTables()+ private function createAccountTables(): void{if (!Schema::hasTable('accounts')) {Schema::create(@@ -127,7 +127,7 @@ class CreateMainTables extends Migration/****/- private function createAttachmentsTable()+ private function createAttachmentsTable(): void{if (!Schema::hasTable('attachments')) {Schema::create(@@ -158,7 +158,7 @@ class CreateMainTables extends Migration/****/- private function createBillsTable()+ private function createBillsTable(): void{if (!Schema::hasTable('bills')) {Schema::create(@@ -190,7 +190,7 @@ class CreateMainTables extends Migration/*** @SuppressWarnings(PHPMD.ExcessiveMethodLength) // cannot be helped.*/- private function createBudgetTables()+ private function createBudgetTables(): void{if (!Schema::hasTable('budgets')) {Schema::create(@@ -241,7 +241,7 @@ class CreateMainTables extends Migration/****/- private function createCategoriesTable()+ private function createCategoriesTable(): void{if (!Schema::hasTable('categories')) {Schema::create(@@ -264,7 +264,7 @@ class CreateMainTables extends Migration/****/- private function createExportJobsTable()+ private function createExportJobsTable(): void{if (!Schema::hasTable('export_jobs')) {Schema::create(@@ -300,7 +300,7 @@ class CreateMainTables extends Migration/****/- private function createPiggyBanksTable()+ private function createPiggyBanksTable(): void{if (!Schema::hasTable('piggy_banks')) {Schema::create(@@ -341,7 +341,7 @@ class CreateMainTables extends Migration/****/- private function createPreferencesTable()+ private function createPreferencesTable(): void{if (!Schema::hasTable('preferences')) {Schema::create(@@ -362,7 +362,7 @@ class CreateMainTables extends Migration/****/- private function createRoleTable()+ private function createRoleTable(): void{if (!Schema::hasTable('role_user')) {Schema::create(@@ -384,7 +384,7 @@ class CreateMainTables extends Migration* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // cannot be helped.* @SuppressWarnings(PHPMD.CyclomaticComplexity) // its exactly five*/- private function createRuleTables()+ private function createRuleTables(): void{if (!Schema::hasTable('rule_groups')) {Schema::create(@@ -472,7 +472,7 @@ class CreateMainTables extends Migration/****/- private function createTagsTable()+ private function createTagsTable(): void{if (!Schema::hasTable('tags')) {Schema::create(@@ -503,7 +503,7 @@ class CreateMainTables extends Migration* @SuppressWarnings(PHPMD.NPathComplexity) // cannot be helped* @SuppressWarnings(PHPMD.CyclomaticComplexity) // its exactly five*/- private function createTransactionTables()+ private function createTransactionTables(): void{if (!Schema::hasTable('transaction_journals')) {Schema::create(diff --git a/database/migrations/2016_08_25_091522_changes_for_3101.php b/database/migrations/2016_08_25_091522_changes_for_3101.phpindex 5fabe0ffe0..d859fa0424 100644--- a/database/migrations/2016_08_25_091522_changes_for_3101.php+++ b/database/migrations/2016_08_25_091522_changes_for_3101.php@@ -31,8 +31,14 @@ class ChangesFor3101 extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{+ Schema::table(+ 'import_jobs',+ function (Blueprint $table) {+ $table->dropColumn('extended_status');+ }+ );}/**@@ -40,7 +46,7 @@ class ChangesFor3101 extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{Schema::table('import_jobs',diff --git a/database/migrations/2016_09_12_121359_fix_nullables.php b/database/migrations/2016_09_12_121359_fix_nullables.phpindex 606e08f4b9..7c7b77a308 100644--- a/database/migrations/2016_09_12_121359_fix_nullables.php+++ b/database/migrations/2016_09_12_121359_fix_nullables.php@@ -31,7 +31,7 @@ class FixNullables extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{}@@ -40,7 +40,7 @@ class FixNullables extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{Schema::table('rule_groups',diff --git a/database/migrations/2016_10_09_150037_expand_transactions_table.php b/database/migrations/2016_10_09_150037_expand_transactions_table.phpindex a6ae3345a2..10e2dbf9e7 100644--- a/database/migrations/2016_10_09_150037_expand_transactions_table.php+++ b/database/migrations/2016_10_09_150037_expand_transactions_table.php@@ -31,8 +31,14 @@ class ExpandTransactionsTable extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{+ Schema::table(+ 'transactions',+ function (Blueprint $table) {+ $table->dropColumn('identifier');+ }+ );}/**@@ -40,7 +46,7 @@ class ExpandTransactionsTable extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{Schema::table('transactions',diff --git a/database/migrations/2016_10_22_075804_changes_for_v410.php b/database/migrations/2016_10_22_075804_changes_for_v410.phpindex 227d40732e..132f350b32 100644--- a/database/migrations/2016_10_22_075804_changes_for_v410.php+++ b/database/migrations/2016_10_22_075804_changes_for_v410.php@@ -31,7 +31,7 @@ class ChangesForV410 extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{Schema::dropIfExists('notes');}@@ -41,7 +41,7 @@ class ChangesForV410 extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{Schema::create('notes',diff --git a/database/migrations/2016_11_24_210552_changes_for_v420.php b/database/migrations/2016_11_24_210552_changes_for_v420.phpindex 9f209d531d..456c9d60b9 100644--- a/database/migrations/2016_11_24_210552_changes_for_v420.php+++ b/database/migrations/2016_11_24_210552_changes_for_v420.php@@ -31,8 +31,14 @@ class ChangesForV420 extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{+ Schema::table(+ 'journal_meta',+ function (Blueprint $table) {+ $table->dropSoftDeletes();+ }+ );}/**@@ -40,7 +46,7 @@ class ChangesForV420 extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{Schema::table('journal_meta',diff --git a/database/migrations/2016_12_22_150431_changes_for_v430.php b/database/migrations/2016_12_22_150431_changes_for_v430.phpindex f35038fcb8..8ddf113b4f 100644--- a/database/migrations/2016_12_22_150431_changes_for_v430.php+++ b/database/migrations/2016_12_22_150431_changes_for_v430.php@@ -31,7 +31,7 @@ class ChangesForV430 extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{Schema::dropIfExists('available_budgets');}@@ -41,7 +41,7 @@ class ChangesForV430 extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{Schema::create('available_budgets',diff --git a/database/migrations/2016_12_28_203205_changes_for_v431.php b/database/migrations/2016_12_28_203205_changes_for_v431.phpindex 10168fb337..1d276d6cee 100644--- a/database/migrations/2016_12_28_203205_changes_for_v431.php+++ b/database/migrations/2016_12_28_203205_changes_for_v431.php@@ -31,7 +31,7 @@ class ChangesForV431 extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{// reinstate "repeats" and "repeat_freq".Schema::table(@@ -47,6 +47,14 @@ class ChangesForV431 extends Migration});+ // change field "start_date" to "startdate"+ Schema::table(+ 'budget_limits',+ function (Blueprint $table) {+ $table->renameColumn('start_date', 'startdate');+ }+ );+// remove date field "end_date"Schema::table('budget_limits',@@ -54,6 +62,13 @@ class ChangesForV431 extends Migration$table->dropColumn('end_date');});+ // remove decimal places+ Schema::table(+ 'transaction_currencies',+ function (Blueprint $table) {+ $table->dropColumn('decimal_places');+ }+ );}/**@@ -61,7 +76,7 @@ class ChangesForV431 extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{// add decimal places to "transaction currencies".Schema::table(diff --git a/database/migrations/2017_04_13_163623_changes_for_v440.php b/database/migrations/2017_04_13_163623_changes_for_v440.phpindex c5829ec619..e6175553a0 100644--- a/database/migrations/2017_04_13_163623_changes_for_v440.php+++ b/database/migrations/2017_04_13_163623_changes_for_v440.php@@ -31,11 +31,23 @@ class ChangesForV440 extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{if (Schema::hasTable('currency_exchange_rates')) {Schema::drop('currency_exchange_rates');}++ Schema::table(+ 'transactions',+ function (Blueprint $table) {++ // cannot drop foreign keys in SQLite:+ if ('sqlite' !== config('database.default')) {+ $table->dropForeign('transactions_transaction_currency_id_foreign');+ }+ $table->dropColumn('transaction_currency_id');+ }+ );}/**@@ -43,7 +55,7 @@ class ChangesForV440 extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{if (!Schema::hasTable('currency_exchange_rates')) {Schema::create(diff --git a/database/migrations/2017_06_02_105232_changes_for_v450.php b/database/migrations/2017_06_02_105232_changes_for_v450.phpindex 4df00f1393..39c3ec1c9b 100644--- a/database/migrations/2017_06_02_105232_changes_for_v450.php+++ b/database/migrations/2017_06_02_105232_changes_for_v450.php@@ -31,8 +31,20 @@ class ChangesForV450 extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{+ Schema::table(+ 'transactions',+ function (Blueprint $table) {+ $table->dropColumn('foreign_amount');++ // cannot drop foreign keys in SQLite:+ if ('sqlite' !== config('database.default')) {+ $table->dropForeign('transactions_foreign_currency_id_foreign');+ }+ $table->dropColumn('foreign_currency_id');+ }+ );}/**@@ -40,7 +52,7 @@ class ChangesForV450 extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{// add "foreign_amount" to transactionsSchema::table(diff --git a/database/migrations/2017_08_20_062014_changes_for_v470.php b/database/migrations/2017_08_20_062014_changes_for_v470.phpindex fc42fba920..9088da2593 100644--- a/database/migrations/2017_08_20_062014_changes_for_v470.php+++ b/database/migrations/2017_08_20_062014_changes_for_v470.php@@ -32,7 +32,7 @@ class ChangesForV470 extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{Schema::dropIfExists('journal_links');Schema::dropIfExists('link_types');@@ -43,7 +43,7 @@ class ChangesForV470 extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{if (!Schema::hasTable('link_types')) {Schema::create(diff --git a/database/migrations/2017_11_04_170844_changes_for_v470a.php b/database/migrations/2017_11_04_170844_changes_for_v470a.phpindex b2d1f603cc..b9d2ebb20e 100644--- a/database/migrations/2017_11_04_170844_changes_for_v470a.php+++ b/database/migrations/2017_11_04_170844_changes_for_v470a.php@@ -32,8 +32,14 @@ class ChangesForV470a extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{+ Schema::table(+ 'transactions',+ function (Blueprint $table) {+ $table->dropColumn('reconciled');+ }+ );}/**@@ -41,7 +47,7 @@ class ChangesForV470a extends Migration** @SuppressWarnings(PHPMD.ShortMethodName)*/- public function up()+ public function up(): void{Schema::table('transactions',diff --git a/database/migrations/2018_01_01_000001_create_oauth_auth_codes_table.php b/database/migrations/2018_01_01_000001_create_oauth_auth_codes_table.phpindex 068f187e0d..4d88023dc6 100644--- a/database/migrations/2018_01_01_000001_create_oauth_auth_codes_table.php+++ b/database/migrations/2018_01_01_000001_create_oauth_auth_codes_table.php@@ -34,7 +34,7 @@ class CreateOauthAuthCodesTable extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{Schema::drop('oauth_auth_codes');}@@ -42,7 +42,7 @@ class CreateOauthAuthCodesTable extends Migration/*** Run the migrations.*/- public function up()+ public function up(): void{Schema::create('oauth_auth_codes', function (Blueprint $table) {diff --git a/database/migrations/2018_01_01_000002_create_oauth_access_tokens_table.php b/database/migrations/2018_01_01_000002_create_oauth_access_tokens_table.phpindex 00889896fb..47101b5a2e 100644--- a/database/migrations/2018_01_01_000002_create_oauth_access_tokens_table.php+++ b/database/migrations/2018_01_01_000002_create_oauth_access_tokens_table.php@@ -34,7 +34,7 @@ class CreateOauthAccessTokensTable extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{Schema::drop('oauth_access_tokens');}@@ -42,7 +42,7 @@ class CreateOauthAccessTokensTable extends Migration/*** Run the migrations.*/- public function up()+ public function up(): void{Schema::create('oauth_access_tokens', function (Blueprint $table) {diff --git a/database/migrations/2018_01_01_000003_create_oauth_refresh_tokens_table.php b/database/migrations/2018_01_01_000003_create_oauth_refresh_tokens_table.phpindex 1d6199d904..b154666881 100644--- a/database/migrations/2018_01_01_000003_create_oauth_refresh_tokens_table.php+++ b/database/migrations/2018_01_01_000003_create_oauth_refresh_tokens_table.php@@ -34,7 +34,7 @@ class CreateOauthRefreshTokensTable extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{Schema::drop('oauth_refresh_tokens');}@@ -42,7 +42,7 @@ class CreateOauthRefreshTokensTable extends Migration/*** Run the migrations.*/- public function up()+ public function up(): void{Schema::create('oauth_refresh_tokens', function (Blueprint $table) {diff --git a/database/migrations/2018_01_01_000004_create_oauth_clients_table.php b/database/migrations/2018_01_01_000004_create_oauth_clients_table.phpindex cbd08eb1db..16c5bc6c87 100644--- a/database/migrations/2018_01_01_000004_create_oauth_clients_table.php+++ b/database/migrations/2018_01_01_000004_create_oauth_clients_table.php@@ -34,7 +34,7 @@ class CreateOauthClientsTable extends Migration/*** Reverse the migrations.*/- public function down()+ public function down(): void{Schema::drop('oauth_clients');}@@ -42,7 +42,7 @@ class CreateOauthClientsTable extends Migration/*** Run the migrations.*/- public function up()+ public function up(): void{Schema::create('oauth_clients', function (Blueprint $table) {diff --git a/database/migrations/2018_01_01_000005_create_oauth_personal_access_clients_table.php b/database/migrations/2018_01_01_000005_create_oauth_personal_access_clients_table.phpindex adc9006492..73e26aff39 100644--- a/database/migrations/2018_01_01_000005_create_oauth_personal_access_clients_table.php+++ b/database/migrations/2018_01_01_000005_create_oauth_personal_access_clients_table.php@@ -37,6 +37,7 @@ class CreateOauthPersonalAccessClientsTable extends Migrationpublic function down(): void{Schema::drop('oauth_personal_access_clients');+}/**diff --git a/database/migrations/2018_03_19_141348_changes_for_v472.php b/database/migrations/2018_03_19_141348_changes_for_v472.phpindex 9a7c4b5a79..abb3afe3ed 100644--- a/database/migrations/2018_03_19_141348_changes_for_v472.php+++ b/database/migrations/2018_03_19_141348_changes_for_v472.php@@ -37,7 +37,18 @@ class ChangesForV472 extends Migration*/public function down(): void{- //+ Schema::table(+ 'attachments',+ function (Blueprint $table) {+ $table->text('notes')->nullable();+ }+ );+ Schema::table(+ 'budgets',+ function (Blueprint $table) {+ $table->dropColumn('order');+ }+ );}/**diff --git a/database/migrations/2018_04_07_210913_changes_for_v473.php b/database/migrations/2018_04_07_210913_changes_for_v473.phpindex 37b70d325c..3ebbb5fe6c 100644--- a/database/migrations/2018_04_07_210913_changes_for_v473.php+++ b/database/migrations/2018_04_07_210913_changes_for_v473.php@@ -38,7 +38,25 @@ class ChangesForV473 extends Migration*/public function down(): void{+ Schema::table(+ 'bills',+ function (Blueprint $table) {++ // cannot drop foreign keys in SQLite:+ if ('sqlite' !== config('database.default')) {+ $table->dropForeign('bills_transaction_currency_id_foreign');+ }+ $table->dropColumn('transaction_currency_id');+ }+ );++ Schema::table(+ 'rules',+ function (Blueprint $table) {+ $table->dropColumn('strict');+ }+ );}/**diff --git a/database/migrations/2018_04_29_174524_changes_for_v474.php b/database/migrations/2018_04_29_174524_changes_for_v474.phpindex 2cda9d050b..dfa7e722ac 100644--- a/database/migrations/2018_04_29_174524_changes_for_v474.php+++ b/database/migrations/2018_04_29_174524_changes_for_v474.php@@ -37,6 +37,23 @@ class ChangesForV474 extends Migration*/public function down(): void{+ Schema::table(+ 'import_jobs',+ function (Blueprint $table) {++ // cannot drop foreign keys in SQLite:+ if ('sqlite' !== config('database.default')) {+ $table->dropForeign('import_jobs_tag_id_foreign');+ }++ $table->dropColumn('provider');+ $table->dropColumn('stage');+ $table->dropColumn('transactions');+ $table->dropColumn('errors');+ $table->dropColumn('tag_id');++ }+ );}/**diff --git a/database/migrations/2018_09_05_195147_changes_for_v477.php b/database/migrations/2018_09_05_195147_changes_for_v477.phpindex 4884689f47..6aae743150 100644--- a/database/migrations/2018_09_05_195147_changes_for_v477.php+++ b/database/migrations/2018_09_05_195147_changes_for_v477.php@@ -38,11 +38,17 @@ class ChangesForV477 extends Migration*/public function down(): void{- //- Schema::table('budget_limits', function (Blueprint $table) {- $table->dropForeign('budget_limits_transaction_currency_id_foreign');+ Schema::table(+ 'budget_limits', function (Blueprint $table) {++ // cannot drop foreign keys in SQLite:+ if ('sqlite' !== config('database.default')) {+ $table->dropForeign('budget_limits_transaction_currency_id_foreign');+ }+$table->dropColumn(['transaction_currency_id']);- });+ }+ );}/**diff --git a/database/migrations/2018_11_06_172532_changes_for_v479.php b/database/migrations/2018_11_06_172532_changes_for_v479.phpindex 2f79e4d015..9846f38f0a 100644--- a/database/migrations/2018_11_06_172532_changes_for_v479.php+++ b/database/migrations/2018_11_06_172532_changes_for_v479.php@@ -36,7 +36,11 @@ class ChangesForV479 extends Migration*/public function down(){- //+ Schema::table(+ 'transaction_currencies', function (Blueprint $table) {+ $table->dropColumn(['enabled']);+ }+ );}/**