Merge branch 'fix/backups' into v2

This commit is contained in:
Matthew Penner 2021-08-03 20:40:40 -06:00
commit 38ddcfb0d9
8 changed files with 54 additions and 10 deletions

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeSuccessfulFieldToDefaultToFalseOnBackupsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('backups', function (Blueprint $table) {
$table->boolean('is_successful')->after('uuid')->default(false)->change();
});
// Convert currently processing backups to the new format so things don't break.
DB::table('backups')->select('id')->where('is_successful', 1)->whereNull('completed_at')->update([
'is_successful' => 0,
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('backups', function (Blueprint $table) {
$table->boolean('is_successful')->after('uuid')->default(true)->change();
});
}
}