mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Some code cleanup and a new migration.
This commit is contained in:
@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateSupportTables.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class CreateSupportTables extends Migration
|
||||
@@ -82,23 +83,6 @@ class CreateSupportTables extends Migration
|
||||
}
|
||||
}
|
||||
|
||||
private function createConfigurationTable(): void
|
||||
{
|
||||
if (!Schema::hasTable('configuration')) {
|
||||
Schema::create(
|
||||
'configuration',
|
||||
static function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->string('name', 50);
|
||||
$table->text('data');
|
||||
$table->unique(['name']);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function createCurrencyTable(): void
|
||||
{
|
||||
if (!Schema::hasTable('transaction_currencies')) {
|
||||
@@ -119,6 +103,24 @@ class CreateSupportTables extends Migration
|
||||
}
|
||||
}
|
||||
|
||||
private function createTransactionTypeTable(): void
|
||||
{
|
||||
if (!Schema::hasTable('transaction_types')) {
|
||||
Schema::create(
|
||||
'transaction_types',
|
||||
static function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->string('type', 50);
|
||||
|
||||
// type must be unique.
|
||||
$table->unique(['type']);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function createJobsTable(): void
|
||||
{
|
||||
if (!Schema::hasTable('jobs')) {
|
||||
@@ -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']);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class CreateUsersTable.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class CreateUsersTable extends Migration
|
||||
|
@@ -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')) {
|
||||
|
@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ChangesFor3101.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesFor3101 extends Migration
|
||||
|
@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class FixNullables.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class FixNullables extends Migration
|
||||
|
@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ExpandTransactionsTable.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ExpandTransactionsTable extends Migration
|
||||
|
@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ChangesForV410.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV410 extends Migration
|
||||
|
@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ChangesForV420.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV420 extends Migration
|
||||
|
@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ChangesForV430.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV430 extends Migration
|
||||
|
@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ChangesForV431.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV431 extends Migration
|
||||
|
@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ChangesForV440.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV440 extends Migration
|
||||
|
@@ -25,6 +25,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ChangesForV450.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV450 extends Migration
|
||||
|
@@ -26,6 +26,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Class ChangesForV470.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV470 extends Migration
|
||||
|
@@ -26,6 +26,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Class ChangesForV470a.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV470a extends Migration
|
||||
|
@@ -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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ChangesForV472.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV472 extends Migration
|
||||
|
@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Class ChangesForV473.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV473 extends Migration
|
||||
|
@@ -27,6 +27,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ChangesForV474.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV474 extends Migration
|
||||
|
@@ -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->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);
|
||||
$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->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->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->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);
|
||||
$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');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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']);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -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']);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Class ChangesForV4710
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV4710 extends Migration
|
||||
@@ -54,14 +55,14 @@ 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();
|
||||
$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');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ChangesForV520.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV520 extends Migration
|
||||
|
@@ -27,6 +27,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ChangesForV530
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV530 extends Migration
|
||||
|
@@ -28,6 +28,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Class ChangesForV530a
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ChangesForV530a extends Migration
|
||||
|
@@ -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();
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
44
database/migrations/2021_03_12_061213_changes_for_v550b2.php
Normal file
44
database/migrations/2021_03_12_061213_changes_for_v550b2.php
Normal file
@@ -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');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user