backups: default is_successful to false (#3522)
* backups: default is_successful to false * backups: properly query backups
This commit is contained in:
parent
b19a1640f0
commit
970f281859
8 changed files with 54 additions and 10 deletions
|
@ -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();
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue