Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Some code cleanup and a new migration.
James Cole97561ab9c993
diff --git a/database/migrations/2016_06_16_000000_create_support_tables.php b/database/migrations/2016_06_16_000000_create_support_tables.phpindex 077eddc433..4d158e268f 100644--- a/database/migrations/2016_06_16_000000_create_support_tables.php+++ b/database/migrations/2016_06_16_000000_create_support_tables.php@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class CreateSupportTables.+ ** @codeCoverageIgnore*/class CreateSupportTables extends Migration@@ -82,38 +83,39 @@ class CreateSupportTables extends Migration}}- private function createConfigurationTable(): void+ private function createCurrencyTable(): void{- if (!Schema::hasTable('configuration')) {+ if (!Schema::hasTable('transaction_currencies')) {Schema::create(- 'configuration',+ 'transaction_currencies',static function (Blueprint $table) {$table->increments('id');$table->timestamps();$table->softDeletes();- $table->string('name', 50);- $table->text('data');- $table->unique(['name']);+ $table->string('code', 3);+ $table->string('name', 255);+ $table->string('symbol', 12);++ // code must be unique.+ $table->unique(['code']);});}}- private function createCurrencyTable(): void+ private function createTransactionTypeTable(): void{- if (!Schema::hasTable('transaction_currencies')) {+ if (!Schema::hasTable('transaction_types')) {Schema::create(- 'transaction_currencies',+ 'transaction_types',static function (Blueprint $table) {$table->increments('id');$table->timestamps();$table->softDeletes();- $table->string('code', 3);- $table->string('name', 255);- $table->string('symbol', 12);+ $table->string('type', 50);- // code must be unique.- $table->unique(['code']);+ // type must be unique.+ $table->unique(['type']);});}@@ -155,24 +157,6 @@ class CreateSupportTables extends Migration}}- private function createPermissionRoleTable(): void- {- if (!Schema::hasTable('permission_role')) {- Schema::create(- 'permission_role',- static function (Blueprint $table) {- $table->integer('permission_id')->unsigned();- $table->integer('role_id')->unsigned();-- $table->foreign('permission_id')->references('id')->on('permissions')->onUpdate('cascade')->onDelete('cascade');- $table->foreign('role_id')->references('id')->on('roles')->onUpdate('cascade')->onDelete('cascade');-- $table->primary(['permission_id', 'role_id']);- }- );- }- }-private function createPermissionsTable(): void{if (!Schema::hasTable('permissions')) {@@ -205,6 +189,24 @@ class CreateSupportTables extends Migration}}+ private function createPermissionRoleTable(): void+ {+ if (!Schema::hasTable('permission_role')) {+ Schema::create(+ 'permission_role',+ static function (Blueprint $table) {+ $table->integer('permission_id')->unsigned();+ $table->integer('role_id')->unsigned();++ $table->foreign('permission_id')->references('id')->on('permissions')->onUpdate('cascade')->onDelete('cascade');+ $table->foreign('role_id')->references('id')->on('roles')->onUpdate('cascade')->onDelete('cascade');++ $table->primary(['permission_id', 'role_id']);+ }+ );+ }+ }+private function createSessionsTable(): void{if (!Schema::hasTable('sessions')) {@@ -222,19 +224,18 @@ class CreateSupportTables extends Migration}}- private function createTransactionTypeTable(): void+ private function createConfigurationTable(): void{- if (!Schema::hasTable('transaction_types')) {+ if (!Schema::hasTable('configuration')) {Schema::create(- 'transaction_types',+ 'configuration',static function (Blueprint $table) {$table->increments('id');$table->timestamps();$table->softDeletes();- $table->string('type', 50);-- // type must be unique.- $table->unique(['type']);+ $table->string('name', 50);+ $table->text('data');+ $table->unique(['name']);});}diff --git a/database/migrations/2016_06_16_000001_create_users_table.php b/database/migrations/2016_06_16_000001_create_users_table.phpindex 412593602d..51202b645f 100644--- a/database/migrations/2016_06_16_000001_create_users_table.php+++ b/database/migrations/2016_06_16_000001_create_users_table.php@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class CreateUsersTable.+ ** @codeCoverageIgnore*/class CreateUsersTable extends Migrationdiff --git a/database/migrations/2016_06_16_000002_create_main_tables.php b/database/migrations/2016_06_16_000002_create_main_tables.phpindex f0ab7205b9..9fb67c46ac 100644--- a/database/migrations/2016_06_16_000002_create_main_tables.php+++ b/database/migrations/2016_06_16_000002_create_main_tables.php@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class CreateMainTables.+ ** @codeCoverageIgnore*/class CreateMainTables extends Migration@@ -122,6 +123,44 @@ class CreateMainTables extends Migration}}+ private function createPiggyBanksTable(): void+ {+ if (!Schema::hasTable('piggy_banks')) {+ Schema::create(+ 'piggy_banks',+ static function (Blueprint $table) {+ $table->increments('id');+ $table->timestamps();+ $table->softDeletes();+ $table->integer('account_id', false, true);+ $table->string('name', 1024);+ $table->decimal('targetamount', 22, 12);+ $table->date('startdate')->nullable();+ $table->date('targetdate')->nullable();+ $table->integer('order', false, true)->default(0);+ $table->boolean('active')->default(0);+ $table->boolean('encrypted')->default(1);+ $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');+ }+ );+ }++ if (!Schema::hasTable('piggy_bank_repetitions')) {+ Schema::create(+ 'piggy_bank_repetitions',+ static function (Blueprint $table) {+ $table->increments('id');+ $table->timestamps();+ $table->integer('piggy_bank_id', false, true);+ $table->date('startdate')->nullable();+ $table->date('targetdate')->nullable();+ $table->decimal('currentamount', 22, 12);+ $table->foreign('piggy_bank_id')->references('id')->on('piggy_banks')->onDelete('cascade');+ }+ );+ }+ }+private function createAttachmentsTable(): void{if (!Schema::hasTable('attachments')) {@@ -283,44 +322,6 @@ class CreateMainTables extends Migration}}- private function createPiggyBanksTable(): void- {- if (!Schema::hasTable('piggy_banks')) {- Schema::create(- 'piggy_banks',- static function (Blueprint $table) {- $table->increments('id');- $table->timestamps();- $table->softDeletes();- $table->integer('account_id', false, true);- $table->string('name', 1024);- $table->decimal('targetamount', 22, 12);- $table->date('startdate')->nullable();- $table->date('targetdate')->nullable();- $table->integer('order', false, true)->default(0);- $table->boolean('active')->default(0);- $table->boolean('encrypted')->default(1);- $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');- }- );- }-- if (!Schema::hasTable('piggy_bank_repetitions')) {- Schema::create(- 'piggy_bank_repetitions',- static function (Blueprint $table) {- $table->increments('id');- $table->timestamps();- $table->integer('piggy_bank_id', false, true);- $table->date('startdate')->nullable();- $table->date('targetdate')->nullable();- $table->decimal('currentamount', 22, 12);- $table->foreign('piggy_bank_id')->references('id')->on('piggy_banks')->onDelete('cascade');- }- );- }- }-private function createPreferencesTable(): void{if (!Schema::hasTable('preferences')) {diff --git a/database/migrations/2016_08_25_091522_changes_for_3101.php b/database/migrations/2016_08_25_091522_changes_for_3101.phpindex 2314ef38c4..237821a2c4 100644--- a/database/migrations/2016_08_25_091522_changes_for_3101.php+++ b/database/migrations/2016_08_25_091522_changes_for_3101.php@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesFor3101.+ ** @codeCoverageIgnore*/class ChangesFor3101 extends Migrationdiff --git a/database/migrations/2016_09_12_121359_fix_nullables.php b/database/migrations/2016_09_12_121359_fix_nullables.phpindex 05cd49e550..34c857cddb 100644--- a/database/migrations/2016_09_12_121359_fix_nullables.php+++ b/database/migrations/2016_09_12_121359_fix_nullables.php@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class FixNullables.+ ** @codeCoverageIgnore*/class FixNullables extends Migrationdiff --git a/database/migrations/2016_10_09_150037_expand_transactions_table.php b/database/migrations/2016_10_09_150037_expand_transactions_table.phpindex 0d4274a947..162da9df5e 100644--- a/database/migrations/2016_10_09_150037_expand_transactions_table.php+++ b/database/migrations/2016_10_09_150037_expand_transactions_table.php@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ExpandTransactionsTable.+ ** @codeCoverageIgnore*/class ExpandTransactionsTable extends Migrationdiff --git a/database/migrations/2016_10_22_075804_changes_for_v410.php b/database/migrations/2016_10_22_075804_changes_for_v410.phpindex 73ee4de023..5d53fc84e3 100644--- a/database/migrations/2016_10_22_075804_changes_for_v410.php+++ b/database/migrations/2016_10_22_075804_changes_for_v410.php@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV410.+ ** @codeCoverageIgnore*/class ChangesForV410 extends Migrationdiff --git a/database/migrations/2016_11_24_210552_changes_for_v420.php b/database/migrations/2016_11_24_210552_changes_for_v420.phpindex 1d80ba5742..3e52c1578b 100644--- a/database/migrations/2016_11_24_210552_changes_for_v420.php+++ b/database/migrations/2016_11_24_210552_changes_for_v420.php@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV420.+ ** @codeCoverageIgnore*/class ChangesForV420 extends Migrationdiff --git a/database/migrations/2016_12_22_150431_changes_for_v430.php b/database/migrations/2016_12_22_150431_changes_for_v430.phpindex 34c7995796..7466b224d7 100644--- a/database/migrations/2016_12_22_150431_changes_for_v430.php+++ b/database/migrations/2016_12_22_150431_changes_for_v430.php@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV430.+ ** @codeCoverageIgnore*/class ChangesForV430 extends Migrationdiff --git a/database/migrations/2016_12_28_203205_changes_for_v431.php b/database/migrations/2016_12_28_203205_changes_for_v431.phpindex f07d68c129..57eac036c3 100644--- a/database/migrations/2016_12_28_203205_changes_for_v431.php+++ b/database/migrations/2016_12_28_203205_changes_for_v431.php@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV431.+ ** @codeCoverageIgnore*/class ChangesForV431 extends Migrationdiff --git a/database/migrations/2017_04_13_163623_changes_for_v440.php b/database/migrations/2017_04_13_163623_changes_for_v440.phpindex 63b3818b70..772ab5b783 100644--- a/database/migrations/2017_04_13_163623_changes_for_v440.php+++ b/database/migrations/2017_04_13_163623_changes_for_v440.php@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV440.+ ** @codeCoverageIgnore*/class ChangesForV440 extends Migrationdiff --git a/database/migrations/2017_06_02_105232_changes_for_v450.php b/database/migrations/2017_06_02_105232_changes_for_v450.phpindex 5fb701d70c..351324af06 100644--- a/database/migrations/2017_06_02_105232_changes_for_v450.php+++ b/database/migrations/2017_06_02_105232_changes_for_v450.php@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV450.+ ** @codeCoverageIgnore*/class ChangesForV450 extends Migrationdiff --git a/database/migrations/2017_08_20_062014_changes_for_v470.php b/database/migrations/2017_08_20_062014_changes_for_v470.phpindex e6ca3225f5..0c2471d80c 100644--- a/database/migrations/2017_08_20_062014_changes_for_v470.php+++ b/database/migrations/2017_08_20_062014_changes_for_v470.php@@ -26,6 +26,7 @@ use Illuminate\Support\Facades\Schema;/*** Class ChangesForV470.+ ** @codeCoverageIgnore*/class ChangesForV470 extends Migrationdiff --git a/database/migrations/2017_11_04_170844_changes_for_v470a.php b/database/migrations/2017_11_04_170844_changes_for_v470a.phpindex 97ff6d47ec..94fab9c06d 100644--- a/database/migrations/2017_11_04_170844_changes_for_v470a.php+++ b/database/migrations/2017_11_04_170844_changes_for_v470a.php@@ -26,6 +26,7 @@ use Illuminate\Support\Facades\Schema;/*** Class ChangesForV470a.+ ** @codeCoverageIgnore*/class ChangesForV470a extends Migrationdiff --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 c742de5ac5..9936125826 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@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;/*** Class CreateOauthAuthCodesTable.+ ** @codeCoverageIgnore*/class CreateOauthAuthCodesTable extends Migration@@ -48,13 +49,13 @@ class CreateOauthAuthCodesTable extends Migration{Schema::create('oauth_auth_codes', static function (Blueprint $table) {- $table->string('id', 100)->primary();- $table->integer('user_id');- $table->integer('client_id');- $table->text('scopes')->nullable();- $table->boolean('revoked');- $table->dateTime('expires_at')->nullable();- }+ $table->string('id', 100)->primary();+ $table->integer('user_id');+ $table->integer('client_id');+ $table->text('scopes')->nullable();+ $table->boolean('revoked');+ $table->dateTime('expires_at')->nullable();+ });}}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 fa1dd8a426..a80077fde9 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@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;/*** Class CreateOauthAccessTokensTable.+ ** @codeCoverageIgnore*/class CreateOauthAccessTokensTable extends Migration@@ -48,15 +49,15 @@ class CreateOauthAccessTokensTable extends Migration{Schema::create('oauth_access_tokens', static function (Blueprint $table) {- $table->string('id', 100)->primary();- $table->integer('user_id')->index()->nullable();- $table->integer('client_id');- $table->string('name')->nullable();- $table->text('scopes')->nullable();- $table->boolean('revoked');- $table->timestamps();- $table->dateTime('expires_at')->nullable();- }+ $table->string('id', 100)->primary();+ $table->integer('user_id')->index()->nullable();+ $table->integer('client_id');+ $table->string('name')->nullable();+ $table->text('scopes')->nullable();+ $table->boolean('revoked');+ $table->timestamps();+ $table->dateTime('expires_at')->nullable();+ });}}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 8be1de2134..945fcd37b2 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@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;/*** Class CreateOauthRefreshTokensTable.+ ** @codeCoverageIgnore*/class CreateOauthRefreshTokensTable extends Migration@@ -48,11 +49,11 @@ class CreateOauthRefreshTokensTable extends Migration{Schema::create('oauth_refresh_tokens', static function (Blueprint $table) {- $table->string('id', 100)->primary();- $table->string('access_token_id', 100)->index();- $table->boolean('revoked');- $table->dateTime('expires_at')->nullable();- }+ $table->string('id', 100)->primary();+ $table->string('access_token_id', 100)->index();+ $table->boolean('revoked');+ $table->dateTime('expires_at')->nullable();+ });}}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 ebac9eef8d..a98019c89b 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@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;/*** Class CreateOauthClientsTable.+ ** @codeCoverageIgnore*/class CreateOauthClientsTable extends Migration@@ -48,16 +49,16 @@ class CreateOauthClientsTable extends Migration{Schema::create('oauth_clients', static function (Blueprint $table) {- $table->increments('id');- $table->integer('user_id')->index()->nullable();- $table->string('name');- $table->string('secret', 100);- $table->text('redirect');- $table->boolean('personal_access_client');- $table->boolean('password_client');- $table->boolean('revoked');- $table->timestamps();- }+ $table->increments('id');+ $table->integer('user_id')->index()->nullable();+ $table->string('name');+ $table->string('secret', 100);+ $table->text('redirect');+ $table->boolean('personal_access_client');+ $table->boolean('password_client');+ $table->boolean('revoked');+ $table->timestamps();+ });}}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 b8dce06bb1..95b52f4e1f 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@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;/*** Class CreateOauthPersonalAccessClientsTable.+ ** @codeCoverageIgnore*/class CreateOauthPersonalAccessClientsTable extends Migration@@ -48,10 +49,10 @@ class CreateOauthPersonalAccessClientsTable extends Migration{Schema::create('oauth_personal_access_clients', static function (Blueprint $table) {- $table->increments('id');- $table->integer('client_id')->index();- $table->timestamps();- }+ $table->increments('id');+ $table->integer('client_id')->index();+ $table->timestamps();+ });}}diff --git a/database/migrations/2018_03_19_141348_changes_for_v472.php b/database/migrations/2018_03_19_141348_changes_for_v472.phpindex 66a87c26d3..060d83cf4b 100644--- a/database/migrations/2018_03_19_141348_changes_for_v472.php+++ b/database/migrations/2018_03_19_141348_changes_for_v472.php@@ -27,6 +27,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV472.+ ** @codeCoverageIgnore*/class ChangesForV472 extends Migrationdiff --git a/database/migrations/2018_04_07_210913_changes_for_v473.php b/database/migrations/2018_04_07_210913_changes_for_v473.phpindex 62aca6b071..d659877176 100644--- a/database/migrations/2018_04_07_210913_changes_for_v473.php+++ b/database/migrations/2018_04_07_210913_changes_for_v473.php@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;/*** Class ChangesForV473.+ ** @codeCoverageIgnore*/class ChangesForV473 extends Migrationdiff --git a/database/migrations/2018_04_29_174524_changes_for_v474.php b/database/migrations/2018_04_29_174524_changes_for_v474.phpindex 5d055ce2f5..b1e9088b78 100644--- a/database/migrations/2018_04_29_174524_changes_for_v474.php+++ b/database/migrations/2018_04_29_174524_changes_for_v474.php@@ -27,6 +27,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV474.+ ** @codeCoverageIgnore*/class ChangesForV474 extends Migrationdiff --git a/database/migrations/2018_06_08_200526_changes_for_v475.php b/database/migrations/2018_06_08_200526_changes_for_v475.phpindex dce990d133..166d6dfbcf 100644--- a/database/migrations/2018_06_08_200526_changes_for_v475.php+++ b/database/migrations/2018_06_08_200526_changes_for_v475.php@@ -27,6 +27,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV475.+ ** @codeCoverageIgnore*/class ChangesForV475 extends Migration@@ -56,92 +57,92 @@ class ChangesForV475 extends Migration{Schema::create('recurrences', static function (Blueprint $table) {- $table->increments('id');- $table->timestamps();- $table->softDeletes();- $table->integer('user_id', false, true);- $table->integer('transaction_type_id', false, true);-- $table->string('title', 1024);- $table->text('description');-- $table->date('first_date');- $table->date('repeat_until')->nullable();- $table->date('latest_date')->nullable();- $table->smallInteger('repetitions', false, true);-- $table->boolean('apply_rules')->default(true);- $table->boolean('active')->default(true);-- $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');- $table->foreign('transaction_type_id')->references('id')->on('transaction_types')->onDelete('cascade');- }+ $table->increments('id');+ $table->timestamps();+ $table->softDeletes();+ $table->integer('user_id', false, true);+ $table->integer('transaction_type_id', false, true);++ $table->string('title', 1024);+ $table->text('description');++ $table->date('first_date');+ $table->date('repeat_until')->nullable();+ $table->date('latest_date')->nullable();+ $table->smallInteger('repetitions', false, true);++ $table->boolean('apply_rules')->default(true);+ $table->boolean('active')->default(true);++ $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');+ $table->foreign('transaction_type_id')->references('id')->on('transaction_types')->onDelete('cascade');+ });Schema::create('recurrences_transactions', static function (Blueprint $table) {- $table->increments('id');- $table->timestamps();- $table->softDeletes();- $table->integer('recurrence_id', false, true);- $table->integer('transaction_currency_id', false, true);- $table->integer('foreign_currency_id', false, true)->nullable();- $table->integer('source_id', false, true);- $table->integer('destination_id', false, true);-- $table->decimal('amount', 22, 12);- $table->decimal('foreign_amount', 22, 12)->nullable();- $table->string('description', 1024);-- $table->foreign('recurrence_id')->references('id')->on('recurrences')->onDelete('cascade');- $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');- $table->foreign('foreign_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null');- $table->foreign('source_id')->references('id')->on('accounts')->onDelete('cascade');- $table->foreign('destination_id')->references('id')->on('accounts')->onDelete('cascade');- }+ $table->increments('id');+ $table->timestamps();+ $table->softDeletes();+ $table->integer('recurrence_id', false, true);+ $table->integer('transaction_currency_id', false, true);+ $table->integer('foreign_currency_id', false, true)->nullable();+ $table->integer('source_id', false, true);+ $table->integer('destination_id', false, true);++ $table->decimal('amount', 22, 12);+ $table->decimal('foreign_amount', 22, 12)->nullable();+ $table->string('description', 1024);++ $table->foreign('recurrence_id')->references('id')->on('recurrences')->onDelete('cascade');+ $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');+ $table->foreign('foreign_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null');+ $table->foreign('source_id')->references('id')->on('accounts')->onDelete('cascade');+ $table->foreign('destination_id')->references('id')->on('accounts')->onDelete('cascade');+ });Schema::create('recurrences_repetitions', static function (Blueprint $table) {- $table->increments('id');- $table->timestamps();- $table->softDeletes();- $table->integer('recurrence_id', false, true);- $table->string('repetition_type', 50);- $table->string('repetition_moment', 50);- $table->smallInteger('repetition_skip', false, true);- $table->smallInteger('weekend', false, true);-- $table->foreign('recurrence_id')->references('id')->on('recurrences')->onDelete('cascade');- }+ $table->increments('id');+ $table->timestamps();+ $table->softDeletes();+ $table->integer('recurrence_id', false, true);+ $table->string('repetition_type', 50);+ $table->string('repetition_moment', 50);+ $table->smallInteger('repetition_skip', false, true);+ $table->smallInteger('weekend', false, true);++ $table->foreign('recurrence_id')->references('id')->on('recurrences')->onDelete('cascade');+ });Schema::create('recurrences_meta', static function (Blueprint $table) {- $table->increments('id');- $table->timestamps();- $table->softDeletes();- $table->integer('recurrence_id', false, true);+ $table->increments('id');+ $table->timestamps();+ $table->softDeletes();+ $table->integer('recurrence_id', false, true);- $table->string('name', 50);- $table->text('value');+ $table->string('name', 50);+ $table->text('value');- $table->foreign('recurrence_id')->references('id')->on('recurrences')->onDelete('cascade');- }+ $table->foreign('recurrence_id')->references('id')->on('recurrences')->onDelete('cascade');+ });Schema::create('rt_meta', static function (Blueprint $table) {- $table->increments('id');- $table->timestamps();- $table->softDeletes();- $table->integer('rt_id', false, true);+ $table->increments('id');+ $table->timestamps();+ $table->softDeletes();+ $table->integer('rt_id', false, true);- $table->string('name', 50);- $table->text('value');+ $table->string('name', 50);+ $table->text('value');- $table->foreign('rt_id')->references('id')->on('recurrences_transactions')->onDelete('cascade');- }+ $table->foreign('rt_id')->references('id')->on('recurrences_transactions')->onDelete('cascade');+ });}}diff --git a/database/migrations/2018_09_05_195147_changes_for_v477.php b/database/migrations/2018_09_05_195147_changes_for_v477.phpindex 5a49e474bd..d9f9678942 100644--- a/database/migrations/2018_09_05_195147_changes_for_v477.php+++ b/database/migrations/2018_09_05_195147_changes_for_v477.php@@ -27,6 +27,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV477.+ ** @codeCoverageIgnore*/class ChangesForV477 extends Migration@@ -42,12 +43,12 @@ class ChangesForV477 extends Migration'budget_limits', static 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']);+ 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 90df8e2499..3001eea2d3 100644--- a/database/migrations/2018_11_06_172532_changes_for_v479.php+++ b/database/migrations/2018_11_06_172532_changes_for_v479.php@@ -27,6 +27,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV479.+ ** @codeCoverageIgnore*/class ChangesForV479 extends Migration@@ -40,8 +41,8 @@ class ChangesForV479 extends Migration{Schema::table('transaction_currencies', static function (Blueprint $table) {- $table->dropColumn(['enabled']);- }+ $table->dropColumn(['enabled']);+ });}diff --git a/database/migrations/2019_01_28_193833_changes_for_v4710.php b/database/migrations/2019_01_28_193833_changes_for_v4710.phpindex c32624a974..dfda36398d 100644--- a/database/migrations/2019_01_28_193833_changes_for_v4710.php+++ b/database/migrations/2019_01_28_193833_changes_for_v4710.php@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;/*** Class ChangesForV4710+ ** @codeCoverageIgnore*/class ChangesForV4710 extends Migration@@ -54,14 +55,14 @@ class ChangesForV4710 extends Migrationif (!Schema::hasTable('transaction_groups')) {Schema::create('transaction_groups', static function (Blueprint $table) {- $table->increments('id');- $table->timestamps();- $table->softDeletes();- $table->integer('user_id', false, true);- $table->string('title', 1024)->nullable();+ $table->increments('id');+ $table->timestamps();+ $table->softDeletes();+ $table->integer('user_id', false, true);+ $table->string('title', 1024)->nullable();- $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');- }+ $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');+ });}diff --git a/database/migrations/2019_02_05_055516_changes_for_v4711.php b/database/migrations/2019_02_05_055516_changes_for_v4711.phpindex 9cfc3f200c..1829ede413 100644--- a/database/migrations/2019_02_05_055516_changes_for_v4711.php+++ b/database/migrations/2019_02_05_055516_changes_for_v4711.php@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;/*** Class ChangesForV4711+ ** @codeCoverageIgnore*/class ChangesForV4711 extends Migration@@ -60,14 +61,14 @@ class ChangesForV4711 extends Migration*/Schema::table('transaction_journals', static function (Blueprint $table) {- $table->dateTime('date')->change();- }+ $table->dateTime('date')->change();+ });Schema::table('preferences', static function (Blueprint $table) {- $table->text('data')->nullable()->change();- }+ $table->text('data')->nullable()->change();+ });}}diff --git a/database/migrations/2019_02_11_170529_changes_for_v4712.php b/database/migrations/2019_02_11_170529_changes_for_v4712.phpindex 24af68eb6f..8d235a6b4e 100644--- a/database/migrations/2019_02_11_170529_changes_for_v4712.php+++ b/database/migrations/2019_02_11_170529_changes_for_v4712.php@@ -27,6 +27,7 @@ use Illuminate\Support\Facades\Schema;/*** Class ChangesForV4712.+ ** @codeCoverageIgnore*/class ChangesForV4712 extends Migration@@ -59,8 +60,8 @@ class ChangesForV4712 extends Migration*/Schema::table('transaction_journals', static function (Blueprint $table) {- $table->dateTime('date')->change();- }+ $table->dateTime('date')->change();+ });}}diff --git a/database/migrations/2019_03_11_223700_fix_ldap_configuration.php b/database/migrations/2019_03_11_223700_fix_ldap_configuration.phpindex 4c3aa712a2..9f16faaa27 100644--- a/database/migrations/2019_03_11_223700_fix_ldap_configuration.php+++ b/database/migrations/2019_03_11_223700_fix_ldap_configuration.php@@ -27,6 +27,7 @@ use Illuminate\Support\Facades\Schema;/*** Class FixLdapConfiguration.+ ** @codeCoverageIgnore*/class FixLdapConfiguration extends Migration@@ -40,8 +41,8 @@ class FixLdapConfiguration extends Migration{Schema::table('users', static function (Blueprint $table) {- $table->dropColumn(['objectguid']);- }+ $table->dropColumn(['objectguid']);+ });}@@ -59,8 +60,8 @@ class FixLdapConfiguration extends Migration*/Schema::table('users', static function (Blueprint $table) {- $table->uuid('objectguid')->nullable()->after('id');- }+ $table->uuid('objectguid')->nullable()->after('id');+ });}}diff --git a/database/migrations/2019_03_22_183214_changes_for_v480.php b/database/migrations/2019_03_22_183214_changes_for_v480.phpindex 71f0b98752..d68a2fbffe 100644--- a/database/migrations/2019_03_22_183214_changes_for_v480.php+++ b/database/migrations/2019_03_22_183214_changes_for_v480.php@@ -26,6 +26,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV480.+ ** @codeCoverageIgnore*/class ChangesForV480 extends Migration@@ -50,14 +51,14 @@ class ChangesForV480 extends Migration);Schema::table('rule_groups', static function (Blueprint $table) {- $table->dropColumn('stop_processing');- }+ $table->dropColumn('stop_processing');+ });Schema::table('users', static function (Blueprint $table) {- $table->dropColumn('mfa_secret');- }+ $table->dropColumn('mfa_secret');+ });}@@ -84,13 +85,13 @@ class ChangesForV480 extends Migration);Schema::table('rule_groups', static function (Blueprint $table) {- $table->boolean('stop_processing')->default(false);- }+ $table->boolean('stop_processing')->default(false);+ });Schema::table('users', static function (Blueprint $table) {- $table->string('mfa_secret', 50)->nullable();- }+ $table->string('mfa_secret', 50)->nullable();+ });}}diff --git a/database/migrations/2019_12_28_191351_make_locations_table.php b/database/migrations/2019_12_28_191351_make_locations_table.phpindex 30eefa6864..0f92217535 100644--- a/database/migrations/2019_12_28_191351_make_locations_table.php+++ b/database/migrations/2019_12_28_191351_make_locations_table.php@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;/*** Class MakeLocationsTable.+ ** @codeCoverageIgnore*/class MakeLocationsTable extends Migration@@ -51,17 +52,17 @@ class MakeLocationsTable extends Migration{Schema::create('locations', static function (Blueprint $table) {- $table->bigIncrements('id');- $table->timestamps();- $table->softDeletes();+ $table->bigIncrements('id');+ $table->timestamps();+ $table->softDeletes();- $table->integer('locatable_id', false, true);- $table->string('locatable_type', 255);+ $table->integer('locatable_id', false, true);+ $table->string('locatable_type', 255);- $table->decimal('latitude', 24, 12)->nullable();- $table->decimal('longitude', 24, 12)->nullable();- $table->smallInteger('zoom_level', false, true)->nullable();- }+ $table->decimal('latitude', 24, 12)->nullable();+ $table->decimal('longitude', 24, 12)->nullable();+ $table->smallInteger('zoom_level', false, true)->nullable();+ });}}diff --git a/database/migrations/2020_03_13_201950_changes_for_v520.php b/database/migrations/2020_03_13_201950_changes_for_v520.phpindex 7cfc93eeb2..72339f579b 100644--- a/database/migrations/2020_03_13_201950_changes_for_v520.php+++ b/database/migrations/2020_03_13_201950_changes_for_v520.php@@ -28,6 +28,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV520.+ ** @codeCoverageIgnore*/class ChangesForV520 extends Migrationdiff --git a/database/migrations/2020_06_07_063612_changes_for_v530.php b/database/migrations/2020_06_07_063612_changes_for_v530.phpindex afc64f15c0..9e20abed8b 100644--- a/database/migrations/2020_06_07_063612_changes_for_v530.php+++ b/database/migrations/2020_06_07_063612_changes_for_v530.php@@ -27,6 +27,7 @@ use Illuminate\Database\Schema\Blueprint;/*** Class ChangesForV530+ ** @codeCoverageIgnore*/class ChangesForV530 extends Migrationdiff --git a/database/migrations/2020_06_30_202620_changes_for_v530a.php b/database/migrations/2020_06_30_202620_changes_for_v530a.phpindex c5f85a156d..b5412de5d4 100644--- a/database/migrations/2020_06_30_202620_changes_for_v530a.php+++ b/database/migrations/2020_06_30_202620_changes_for_v530a.php@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;/*** Class ChangesForV530a+ ** @codeCoverageIgnore*/class ChangesForV530a extends Migrationdiff --git a/database/migrations/2020_07_24_162820_changes_for_v540.php b/database/migrations/2020_07_24_162820_changes_for_v540.phpindex bad51fd403..990ea11eac 100644--- a/database/migrations/2020_07_24_162820_changes_for_v540.php+++ b/database/migrations/2020_07_24_162820_changes_for_v540.php@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;/*** Class ChangesForV540+ ** @codeCoverageIgnore*/class ChangesForV540 extends Migration@@ -85,8 +86,10 @@ class ChangesForV540 extends Migration// make column nullable:- Schema::table('oauth_clients', function (Blueprint $table) {+ Schema::table(+ 'oauth_clients', function (Blueprint $table) {$table->string('secret', 100)->nullable()->change();- });+ }+ );}}diff --git a/database/migrations/2021_03_12_061213_changes_for_v550b2.php b/database/migrations/2021_03_12_061213_changes_for_v550b2.phpnew file mode 100644index 0000000000..707b29ebf9--- /dev/null+++ b/database/migrations/2021_03_12_061213_changes_for_v550b2.php@@ -0,0 +1,44 @@+<?php++use Illuminate\Database\Migrations\Migration;+use Illuminate\Database\Schema\Blueprint;+use Illuminate\Support\Facades\Schema;++/**+ * Class ChangesForV550b2+ */+class ChangesForV550b2 extends Migration+{+ /**+ * Reverse the migrations.+ *+ * @return void+ */+ public function down(): void+ {+ Schema::table(+ 'recurrences_transactions', function (Blueprint $table) {++ $table->dropForeign('type_foreign');+ $table->dropColumn('transaction_type_id');++ }+ );+ }++ /**+ * Run the migrations.+ *+ * @return void+ */+ public function up(): void+ {+ // expand recurrence transaction table+ Schema::table(+ 'recurrences_transactions', function (Blueprint $table) {+ $table->integer('transaction_type_id', false, true)->nullable()->after('transaction_currency_id');+ $table->foreign('transaction_type_id', 'type_foreign')->references('id')->on('transaction_types')->onDelete('set null');+ }+ );+ }+}