mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 02:26:58 +00:00
Add some if-statements to the migrations.
This commit is contained in:
@@ -120,9 +120,11 @@ class ChangesForV550 extends Migration
|
||||
// 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');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// append budget limits table.
|
||||
@@ -130,12 +132,17 @@ class ChangesForV550 extends Migration
|
||||
Schema::table(
|
||||
'budget_limits',
|
||||
static function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('budget_limits', 'period')) {
|
||||
$table->string('period', 12)->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('budget_limits', 'generated')) {
|
||||
$table->boolean('generated')->default(false);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// new webhooks table
|
||||
if (!Schema::hasTable('webhooks')) {
|
||||
Schema::create(
|
||||
'webhooks',
|
||||
static function (Blueprint $table) {
|
||||
@@ -154,8 +161,10 @@ class ChangesForV550 extends Migration
|
||||
$table->unique(['user_id', 'title']);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// new webhook_messages table
|
||||
if (!Schema::hasTable('webhook_messages')) {
|
||||
Schema::create(
|
||||
'webhook_messages',
|
||||
static function (Blueprint $table) {
|
||||
@@ -172,7 +181,9 @@ class ChangesForV550 extends Migration
|
||||
$table->foreign('webhook_id')->references('id')->on('webhooks')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!Schema::hasTable('webhook_attempts')) {
|
||||
Schema::create(
|
||||
'webhook_attempts',
|
||||
static function (Blueprint $table) {
|
||||
@@ -189,4 +200,5 @@ class ChangesForV550 extends Migration
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user