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