mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Various PSR12 code cleanup
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2016_06_16_000000_create_support_tables.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2016_06_16_000001_create_users_table.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2016_06_16_000002_create_main_tables.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2016_08_25_091522_changes_for_3101.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2016_09_12_121359_fix_nullables.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2016_10_09_150037_expand_transactions_table.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2016_10_22_075804_changes_for_v410.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2016_11_24_210552_changes_for_v420.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2016_12_22_150431_changes_for_v430.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2016_12_28_203205_changes_for_v431.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2017_04_13_163623_changes_for_v440.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2017_06_02_105232_changes_for_v450.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2017_08_20_062014_changes_for_v470.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2017_11_04_170844_changes_for_v470a.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -48,14 +48,15 @@ class CreateOauthAuthCodesTable extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
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();
|
||||
}
|
||||
'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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -48,16 +48,17 @@ class CreateOauthAccessTokensTable extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
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();
|
||||
}
|
||||
'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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -48,12 +48,13 @@ class CreateOauthRefreshTokensTable extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
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();
|
||||
}
|
||||
'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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -48,17 +48,18 @@ class CreateOauthClientsTable extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
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();
|
||||
}
|
||||
'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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -48,11 +48,12 @@ class CreateOauthPersonalAccessClientsTable extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create(
|
||||
'oauth_personal_access_clients', static function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('client_id')->index();
|
||||
$table->timestamps();
|
||||
}
|
||||
'oauth_personal_access_clients',
|
||||
static function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('client_id')->index();
|
||||
$table->timestamps();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -43,7 +43,6 @@ class ChangesForV473 extends Migration
|
||||
Schema::table(
|
||||
'bills',
|
||||
static function (Blueprint $table) {
|
||||
|
||||
// cannot drop foreign keys in SQLite:
|
||||
if ('sqlite' !== config('database.default')) {
|
||||
$table->dropForeign('bills_transaction_currency_id_foreign');
|
||||
|
@@ -44,7 +44,6 @@ class ChangesForV474 extends Migration
|
||||
Schema::table(
|
||||
'import_jobs',
|
||||
static function (Blueprint $table) {
|
||||
|
||||
// cannot drop foreign keys in SQLite:
|
||||
if ('sqlite' !== config('database.default')) {
|
||||
$table->dropForeign('import_jobs_tag_id_foreign');
|
||||
|
@@ -56,93 +56,98 @@ class ChangesForV475 extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
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);
|
||||
'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->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->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->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->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);
|
||||
'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', 36, 24);
|
||||
$table->decimal('foreign_amount', 36, 24)->nullable();
|
||||
$table->string('description', 1024);
|
||||
$table->decimal('amount', 36, 24);
|
||||
$table->decimal('foreign_amount', 36, 24)->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->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);
|
||||
'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->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);
|
||||
'recurrences_meta',
|
||||
static function (Blueprint $table) {
|
||||
$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);
|
||||
'rt_meta',
|
||||
static function (Blueprint $table) {
|
||||
$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');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -40,15 +40,15 @@ class ChangesForV477 extends Migration
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table(
|
||||
'budget_limits', static function (Blueprint $table) {
|
||||
'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');
|
||||
}
|
||||
|
||||
// cannot drop foreign keys in SQLite:
|
||||
if ('sqlite' !== config('database.default')) {
|
||||
$table->dropForeign('budget_limits_transaction_currency_id_foreign');
|
||||
$table->dropColumn(['transaction_currency_id']);
|
||||
}
|
||||
|
||||
$table->dropColumn(['transaction_currency_id']);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -40,9 +40,10 @@ class ChangesForV479 extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table(
|
||||
'transaction_currencies', static function (Blueprint $table) {
|
||||
$table->dropColumn(['enabled']);
|
||||
}
|
||||
'transaction_currencies',
|
||||
static function (Blueprint $table) {
|
||||
$table->dropColumn(['enabled']);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -54,15 +54,16 @@ class ChangesForV4710 extends Migration
|
||||
{
|
||||
if (!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();
|
||||
'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->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
}
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -60,15 +60,17 @@ class ChangesForV4711 extends Migration
|
||||
* nice.
|
||||
*/
|
||||
Schema::table(
|
||||
'transaction_journals', static function (Blueprint $table) {
|
||||
$table->dateTime('date')->change();
|
||||
}
|
||||
'transaction_journals',
|
||||
static function (Blueprint $table) {
|
||||
$table->dateTime('date')->change();
|
||||
}
|
||||
);
|
||||
|
||||
Schema::table(
|
||||
'preferences', static function (Blueprint $table) {
|
||||
$table->text('data')->nullable()->change();
|
||||
}
|
||||
'preferences',
|
||||
static function (Blueprint $table) {
|
||||
$table->text('data')->nullable()->change();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -59,9 +59,10 @@ class ChangesForV4712 extends Migration
|
||||
* nice.
|
||||
*/
|
||||
Schema::table(
|
||||
'transaction_journals', static function (Blueprint $table) {
|
||||
$table->dateTime('date')->change();
|
||||
}
|
||||
'transaction_journals',
|
||||
static function (Blueprint $table) {
|
||||
$table->dateTime('date')->change();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -40,9 +40,10 @@ class FixLdapConfiguration extends Migration
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table(
|
||||
'users', static function (Blueprint $table) {
|
||||
$table->dropColumn(['objectguid']);
|
||||
}
|
||||
'users',
|
||||
static function (Blueprint $table) {
|
||||
$table->dropColumn(['objectguid']);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -59,9 +60,10 @@ class FixLdapConfiguration extends Migration
|
||||
* now. To support this, we add the column.
|
||||
*/
|
||||
Schema::table(
|
||||
'users', static function (Blueprint $table) {
|
||||
$table->uuid('objectguid')->nullable()->after('id');
|
||||
}
|
||||
'users',
|
||||
static function (Blueprint $table) {
|
||||
$table->uuid('objectguid')->nullable()->after('id');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -50,15 +50,17 @@ class ChangesForV480 extends Migration
|
||||
}
|
||||
);
|
||||
Schema::table(
|
||||
'rule_groups', static function (Blueprint $table) {
|
||||
$table->dropColumn('stop_processing');
|
||||
}
|
||||
'rule_groups',
|
||||
static function (Blueprint $table) {
|
||||
$table->dropColumn('stop_processing');
|
||||
}
|
||||
);
|
||||
|
||||
Schema::table(
|
||||
'users', static function (Blueprint $table) {
|
||||
$table->dropColumn('mfa_secret');
|
||||
}
|
||||
'users',
|
||||
static function (Blueprint $table) {
|
||||
$table->dropColumn('mfa_secret');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -84,14 +86,16 @@ class ChangesForV480 extends Migration
|
||||
}
|
||||
);
|
||||
Schema::table(
|
||||
'rule_groups', static function (Blueprint $table) {
|
||||
$table->boolean('stop_processing')->default(false);
|
||||
}
|
||||
'rule_groups',
|
||||
static function (Blueprint $table) {
|
||||
$table->boolean('stop_processing')->default(false);
|
||||
}
|
||||
);
|
||||
Schema::table(
|
||||
'users', static function (Blueprint $table) {
|
||||
$table->string('mfa_secret', 50)->nullable();
|
||||
}
|
||||
'users',
|
||||
static function (Blueprint $table) {
|
||||
$table->string('mfa_secret', 50)->nullable();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -51,18 +51,19 @@ class MakeLocationsTable extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::create(
|
||||
'locations', static function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
'locations',
|
||||
static function (Blueprint $table) {
|
||||
$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', 36, 24)->nullable();
|
||||
$table->decimal('longitude', 36, 24)->nullable();
|
||||
$table->smallInteger('zoom_level', false, true)->nullable();
|
||||
}
|
||||
$table->decimal('latitude', 36, 24)->nullable();
|
||||
$table->decimal('longitude', 36, 24)->nullable();
|
||||
$table->smallInteger('zoom_level', false, true)->nullable();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -52,24 +52,26 @@ class ChangesForV530 extends Migration
|
||||
{
|
||||
if (!Schema::hasTable('object_groups')) {
|
||||
Schema::create(
|
||||
'object_groups', static function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('user_id', false, true);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->string('title', 255);
|
||||
$table->mediumInteger('order', false, true)->default(0);
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
}
|
||||
'object_groups',
|
||||
static function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('user_id', false, true);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->string('title', 255);
|
||||
$table->mediumInteger('order', false, true)->default(0);
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
if (!Schema::hasTable('object_groupables')) {
|
||||
Schema::create(
|
||||
'object_groupables', static function (Blueprint $table) {
|
||||
$table->integer('object_group_id');
|
||||
$table->integer('object_groupable_id', false, true);
|
||||
$table->string('object_groupable_type', 255);
|
||||
}
|
||||
'object_groupables',
|
||||
static function (Blueprint $table) {
|
||||
$table->integer('object_group_id');
|
||||
$table->integer('object_groupable_id', false, true);
|
||||
$table->string('object_groupable_type', 255);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -41,9 +41,10 @@ class ChangesForV530a extends Migration
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table(
|
||||
'bills', static function (Blueprint $table) {
|
||||
$table->dropColumn('order');
|
||||
}
|
||||
'bills',
|
||||
static function (Blueprint $table) {
|
||||
$table->dropColumn('order');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -55,9 +56,10 @@ class ChangesForV530a extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table(
|
||||
'bills', static function (Blueprint $table) {
|
||||
$table->integer('order', false, true)->default(0);
|
||||
}
|
||||
'bills',
|
||||
static function (Blueprint $table) {
|
||||
$table->integer('order', false, true)->default(0);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -41,22 +41,25 @@ class ChangesForV540 extends Migration
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table(
|
||||
'oauth_clients', static function (Blueprint $table) {
|
||||
$table->dropColumn('provider');
|
||||
}
|
||||
'oauth_clients',
|
||||
static function (Blueprint $table) {
|
||||
$table->dropColumn('provider');
|
||||
}
|
||||
);
|
||||
|
||||
Schema::table(
|
||||
'accounts', static function (Blueprint $table) {
|
||||
$table->dropColumn('order');
|
||||
}
|
||||
'accounts',
|
||||
static function (Blueprint $table) {
|
||||
$table->dropColumn('order');
|
||||
}
|
||||
);
|
||||
|
||||
Schema::table(
|
||||
'bills', static function (Blueprint $table) {
|
||||
$table->dropColumn('end_date');
|
||||
$table->dropColumn('extension_date');
|
||||
}
|
||||
'bills',
|
||||
static function (Blueprint $table) {
|
||||
$table->dropColumn('end_date');
|
||||
$table->dropColumn('extension_date');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -68,26 +71,30 @@ class ChangesForV540 extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table(
|
||||
'accounts', static function (Blueprint $table) {
|
||||
$table->integer('order', false, true)->default(0);
|
||||
}
|
||||
'accounts',
|
||||
static function (Blueprint $table) {
|
||||
$table->integer('order', false, true)->default(0);
|
||||
}
|
||||
);
|
||||
Schema::table(
|
||||
'oauth_clients', static function (Blueprint $table) {
|
||||
$table->string('provider')->nullable();
|
||||
}
|
||||
'oauth_clients',
|
||||
static function (Blueprint $table) {
|
||||
$table->string('provider')->nullable();
|
||||
}
|
||||
);
|
||||
Schema::table(
|
||||
'bills', static function (Blueprint $table) {
|
||||
$table->date('end_date')->nullable()->after('date');
|
||||
$table->date('extension_date')->nullable()->after('end_date');
|
||||
}
|
||||
'bills',
|
||||
static function (Blueprint $table) {
|
||||
$table->date('end_date')->nullable()->after('date');
|
||||
$table->date('extension_date')->nullable()->after('end_date');
|
||||
}
|
||||
);
|
||||
// make column nullable:
|
||||
Schema::table(
|
||||
'oauth_clients', function (Blueprint $table) {
|
||||
$table->string('secret', 100)->nullable()->change();
|
||||
}
|
||||
'oauth_clients',
|
||||
function (Blueprint $table) {
|
||||
$table->string('secret', 100)->nullable()->change();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -58,10 +58,11 @@ class ChangesForV550 extends Migration
|
||||
|
||||
// expand budget / transaction journal table.
|
||||
Schema::table(
|
||||
'budget_transaction_journal', function (Blueprint $table) {
|
||||
$table->dropForeign('budget_id_foreign');
|
||||
$table->dropColumn('budget_limit_id');
|
||||
}
|
||||
'budget_transaction_journal',
|
||||
function (Blueprint $table) {
|
||||
$table->dropForeign('budget_id_foreign');
|
||||
$table->dropColumn('budget_limit_id');
|
||||
}
|
||||
);
|
||||
|
||||
// drop failed jobs table.
|
||||
@@ -91,40 +92,43 @@ class ChangesForV550 extends Migration
|
||||
Schema::dropIfExists('jobs');
|
||||
// this is the NEW table
|
||||
Schema::create(
|
||||
'jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
}
|
||||
'jobs',
|
||||
function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
}
|
||||
);
|
||||
// drop failed jobs table.
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
|
||||
// create new failed_jobs table.
|
||||
Schema::create(
|
||||
'failed_jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
}
|
||||
'failed_jobs',
|
||||
function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
}
|
||||
);
|
||||
|
||||
// update budget / transaction journal table.
|
||||
Schema::table(
|
||||
'budget_transaction_journal', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('budget_transaction_journal', 'budget_limit_id')) {
|
||||
$table->integer('budget_limit_id', false, true)->nullable()->default(null)->after('budget_id');
|
||||
$table->foreign('budget_limit_id', 'budget_id_foreign')->references('id')->on('budget_limits')->onDelete('set null');
|
||||
'budget_transaction_journal',
|
||||
function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('budget_transaction_journal', 'budget_limit_id')) {
|
||||
$table->integer('budget_limit_id', false, true)->nullable()->default(null)->after('budget_id');
|
||||
$table->foreign('budget_limit_id', 'budget_id_foreign')->references('id')->on('budget_limits')->onDelete('set null');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// append budget limits table.
|
||||
|
@@ -39,14 +39,13 @@ class ChangesForV550b2 extends Migration
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table(
|
||||
'recurrences_transactions', function (Blueprint $table) {
|
||||
|
||||
$table->dropForeign('type_foreign');
|
||||
if (Schema::hasColumn('recurrences_transactions', 'transaction_type_id')) {
|
||||
$table->dropColumn('transaction_type_id');
|
||||
'recurrences_transactions',
|
||||
function (Blueprint $table) {
|
||||
$table->dropForeign('type_foreign');
|
||||
if (Schema::hasColumn('recurrences_transactions', 'transaction_type_id')) {
|
||||
$table->dropColumn('transaction_type_id');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -59,12 +58,13 @@ class ChangesForV550b2 extends Migration
|
||||
{
|
||||
// expand recurrence transaction table
|
||||
Schema::table(
|
||||
'recurrences_transactions', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('recurrences_transactions', 'transaction_type_id')) {
|
||||
$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');
|
||||
'recurrences_transactions',
|
||||
function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('recurrences_transactions', 'transaction_type_id')) {
|
||||
$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');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -34,9 +34,10 @@ class AddLdapColumnsToUsersTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table(
|
||||
'users', function (Blueprint $table) {
|
||||
$table->dropColumn(['domain']);
|
||||
}
|
||||
'users',
|
||||
function (Blueprint $table) {
|
||||
$table->dropColumn(['domain']);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -46,9 +47,10 @@ class AddLdapColumnsToUsersTable extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table(
|
||||
'users', function (Blueprint $table) {
|
||||
$table->string('domain')->nullable();
|
||||
}
|
||||
'users',
|
||||
function (Blueprint $table) {
|
||||
$table->string('domain')->nullable();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -49,10 +49,11 @@ class ExtendCurrencyInfo extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table(
|
||||
'transaction_currencies', function (Blueprint $table) {
|
||||
$table->string('code', 51)->change();
|
||||
$table->string('symbol', 51)->change();
|
||||
}
|
||||
'transaction_currencies',
|
||||
function (Blueprint $table) {
|
||||
$table->string('code', 51)->change();
|
||||
$table->string('symbol', 51)->change();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -32,8 +32,21 @@ use Illuminate\Support\Facades\Schema;
|
||||
class UserGroups extends Migration
|
||||
{
|
||||
private array $tables
|
||||
= ['accounts', 'attachments', 'available_budgets', 'bills', 'budgets', 'categories', 'recurrences', 'rule_groups', 'rules', 'tags',
|
||||
'transaction_groups', 'transaction_journals', 'webhooks'];
|
||||
= [
|
||||
'accounts',
|
||||
'attachments',
|
||||
'available_budgets',
|
||||
'bills',
|
||||
'budgets',
|
||||
'categories',
|
||||
'recurrences',
|
||||
'rule_groups',
|
||||
'rules',
|
||||
'tags',
|
||||
'transaction_groups',
|
||||
'transaction_journals',
|
||||
'webhooks',
|
||||
];
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
@@ -46,25 +59,24 @@ class UserGroups extends Migration
|
||||
/** @var string $tableName */
|
||||
foreach ($this->tables as $tableName) {
|
||||
Schema::table(
|
||||
$tableName, function (Blueprint $table) use ($tableName) {
|
||||
|
||||
$table->dropForeign(sprintf('%s_to_ugi', $tableName));
|
||||
if (Schema::hasColumn($tableName, 'user_group_id')) {
|
||||
$table->dropColumn('user_group_id');
|
||||
$tableName,
|
||||
function (Blueprint $table) use ($tableName) {
|
||||
$table->dropForeign(sprintf('%s_to_ugi', $tableName));
|
||||
if (Schema::hasColumn($tableName, 'user_group_id')) {
|
||||
$table->dropColumn('user_group_id');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Schema::table(
|
||||
'users', function (Blueprint $table) {
|
||||
|
||||
$table->dropForeign('type_user_group_id');
|
||||
if (Schema::hasColumn('users', 'user_group_id')) {
|
||||
$table->dropColumn('user_group_id');
|
||||
'users',
|
||||
function (Blueprint $table) {
|
||||
$table->dropForeign('type_user_group_id');
|
||||
if (Schema::hasColumn('users', 'user_group_id')) {
|
||||
$table->dropColumn('user_group_id');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
Schema::dropIfExists('group_memberships');
|
||||
@@ -84,25 +96,27 @@ class UserGroups extends Migration
|
||||
* may have multiple roles in a group
|
||||
*/
|
||||
Schema::create(
|
||||
'user_groups', static function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
'user_groups',
|
||||
static function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->string('title', 255);
|
||||
$table->unique('title');
|
||||
}
|
||||
$table->string('title', 255);
|
||||
$table->unique('title');
|
||||
}
|
||||
);
|
||||
|
||||
Schema::create(
|
||||
'user_roles', static function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
'user_roles',
|
||||
static function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->string('title', 255);
|
||||
$table->unique('title');
|
||||
}
|
||||
$table->string('title', 255);
|
||||
$table->unique('title');
|
||||
}
|
||||
);
|
||||
|
||||
Schema::create(
|
||||
@@ -122,27 +136,29 @@ class UserGroups extends Migration
|
||||
}
|
||||
);
|
||||
Schema::table(
|
||||
'users', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('users', 'user_group_id')) {
|
||||
$table->bigInteger('user_group_id', false, true)->nullable();
|
||||
$table->foreign('user_group_id', 'type_user_group_id')->references('id')->on('user_groups')->onDelete('set null')->onUpdate('cascade');
|
||||
'users',
|
||||
function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('users', 'user_group_id')) {
|
||||
$table->bigInteger('user_group_id', false, true)->nullable();
|
||||
$table->foreign('user_group_id', 'type_user_group_id')->references('id')->on('user_groups')->onDelete('set null')->onUpdate('cascade');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// ADD columns from tables
|
||||
/** @var string $tableName */
|
||||
foreach ($this->tables as $tableName) {
|
||||
Schema::table(
|
||||
$tableName, function (Blueprint $table) use ($tableName) {
|
||||
|
||||
if (!Schema::hasColumn($tableName, 'user_group_id')) {
|
||||
$table->bigInteger('user_group_id', false, true)->nullable()->after('user_id');
|
||||
$table->foreign('user_group_id', sprintf('%s_to_ugi', $tableName))->references('id')->on('user_groups')->onDelete('set null')->onUpdate('cascade');
|
||||
$tableName,
|
||||
function (Blueprint $table) use ($tableName) {
|
||||
if (!Schema::hasColumn($tableName, 'user_group_id')) {
|
||||
$table->bigInteger('user_group_id', false, true)->nullable()->after('user_id');
|
||||
$table->foreign('user_group_id', sprintf('%s_to_ugi', $tableName))->references('id')->on('user_groups')->onDelete('set null')->onUpdate(
|
||||
'cascade'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
return new class extends Migration {
|
||||
return new class () extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -38,13 +38,13 @@ return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table(
|
||||
'currency_exchange_rates', function (Blueprint $table) {
|
||||
|
||||
if (!Schema::hasColumn('currency_exchange_rates', 'user_group_id')) {
|
||||
$table->bigInteger('user_group_id', false, true)->nullable()->after('user_id');
|
||||
$table->foreign('user_group_id', 'cer_to_ugi')->references('id')->on('user_groups')->onDelete('set null')->onUpdate('cascade');
|
||||
'currency_exchange_rates',
|
||||
function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('currency_exchange_rates', 'user_group_id')) {
|
||||
$table->bigInteger('user_group_id', false, true)->nullable()->after('user_id');
|
||||
$table->foreign('user_group_id', 'cer_to_ugi')->references('id')->on('user_groups')->onDelete('set null')->onUpdate('cascade');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -56,13 +56,13 @@ return new class extends Migration {
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table(
|
||||
'currency_exchange_rates', function (Blueprint $table) {
|
||||
|
||||
$table->dropForeign('cer_to_ugi');
|
||||
if (Schema::hasColumn('currency_exchange_rates', 'user_group_id')) {
|
||||
$table->dropColumn('user_group_id');
|
||||
'currency_exchange_rates',
|
||||
function (Blueprint $table) {
|
||||
$table->dropForeign('cer_to_ugi');
|
||||
if (Schema::hasColumn('currency_exchange_rates', 'user_group_id')) {
|
||||
$table->dropColumn('user_group_id');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@@ -26,8 +26,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
return new class () extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
|
@@ -26,8 +26,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
return new class () extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
|
@@ -26,8 +26,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
return new class () extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AccountTypeSeeder.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -49,7 +49,7 @@ class ConfigSeeder extends Seeder
|
||||
);
|
||||
}
|
||||
if (null !== $entry) {
|
||||
$version = (int) config('firefly.db_version');
|
||||
$version = (int)config('firefly.db_version');
|
||||
$entry->data = $version;
|
||||
$entry->save();
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* DatabaseSeeder.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -72,7 +72,7 @@ class ExchangeRateSeeder extends Seeder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
* @param string $code
|
||||
* @return TransactionCurrency|null
|
||||
*/
|
||||
private function getCurrency(string $code): ?TransactionCurrency
|
||||
@@ -81,10 +81,10 @@ class ExchangeRateSeeder extends Seeder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param TransactionCurrency $from
|
||||
* @param TransactionCurrency $to
|
||||
* @param string $date
|
||||
* @param User $user
|
||||
* @param TransactionCurrency $from
|
||||
* @param TransactionCurrency $to
|
||||
* @param string $date
|
||||
* @return bool
|
||||
*/
|
||||
private function hasRate(User $user, TransactionCurrency $from, TransactionCurrency $to, string $date): bool
|
||||
@@ -97,11 +97,11 @@ class ExchangeRateSeeder extends Seeder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param TransactionCurrency $from
|
||||
* @param TransactionCurrency $to
|
||||
* @param string $date
|
||||
* @param float $rate
|
||||
* @param User $user
|
||||
* @param TransactionCurrency $from
|
||||
* @param TransactionCurrency $to
|
||||
* @param string $date
|
||||
* @param float $rate
|
||||
* @return void
|
||||
*/
|
||||
private function addRate(User $user, TransactionCurrency $from, TransactionCurrency $to, string $date, float $rate): void
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LinkTypeSeeder.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PermissionSeeder.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* TransactionCurrencySeeder.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* TransactionTypeSeeder.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org.
|
||||
|
Reference in New Issue
Block a user