Expand table.

This commit is contained in:
James Cole
2020-11-13 14:03:04 +01:00
parent 5fce6af00a
commit f7490176ec

View File

@@ -16,6 +16,7 @@ class ChangesForV550 extends Migration
*/ */
public function down() public function down()
{ {
// recreate jobs table.
Schema::drop('jobs'); Schema::drop('jobs');
Schema::create( Schema::create(
'jobs', 'jobs',
@@ -32,13 +33,26 @@ class ChangesForV550 extends Migration
$table->index(['queue', 'reserved', 'reserved_at']); $table->index(['queue', 'reserved', 'reserved_at']);
} }
); );
// expand budget / transaction journal table.
Schema::table( Schema::table(
'budget_transaction_journal', function (Blueprint $table) { 'budget_transaction_journal', function (Blueprint $table) {
$table->dropForeign('budget_id_foreign'); $table->dropForeign('budget_id_foreign');
$table->dropColumn('budget_limit_id'); $table->dropColumn('budget_limit_id');
} }
); );
// drop failed jobs table.
Schema::dropIfExists('failed_jobs'); Schema::dropIfExists('failed_jobs');
// drop fields from budget limits
Schema::table(
'budget_limits',
static function (Blueprint $table) {
$table->dropColumn('repeat_freq');
$table->dropColumn('auto_budget');
}
);
} }
/** /**
@@ -48,6 +62,7 @@ class ChangesForV550 extends Migration
*/ */
public function up() public function up()
{ {
// drop and recreate jobs table.
Schema::drop('jobs'); Schema::drop('jobs');
// this is the NEW table // this is the NEW table
Schema::create( Schema::create(
@@ -62,6 +77,7 @@ class ChangesForV550 extends Migration
} }
); );
// create new failed_jobs table.
Schema::create( Schema::create(
'failed_jobs', function (Blueprint $table) { 'failed_jobs', function (Blueprint $table) {
$table->id(); $table->id();
@@ -74,6 +90,7 @@ class ChangesForV550 extends Migration
} }
); );
// update budget / transaction journal table.
Schema::table( Schema::table(
'budget_transaction_journal', function (Blueprint $table) { 'budget_transaction_journal', function (Blueprint $table) {
$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');
@@ -82,5 +99,15 @@ class ChangesForV550 extends Migration
} }
); );
// append budget limits table.
// i swear I dropped & recreated this field 15 times already.
Schema::table(
'budget_limits',
static function (Blueprint $table) {
$table->string('repeat_freq', 12)->nullable();
$table->boolean('auto_budget')->default(false);
}
);
} }
} }