feat: close alumb
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Device;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
$driver = Schema::getConnection()->getDriverName();
|
||||
if ($driver === 'mysql') {
|
||||
DB::statement('ALTER TABLE devices MODIFY album_storage TINYINT(1) NOT NULL DEFAULT 0');
|
||||
}
|
||||
|
||||
DB::table('devices')
|
||||
->where('has_wallet', '!=', Device::WALLET_YES)
|
||||
->update(['album_storage' => false]);
|
||||
DB::table('devices')
|
||||
->where('has_wallet', Device::WALLET_YES)
|
||||
->update(['album_storage' => true]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
$driver = Schema::getConnection()->getDriverName();
|
||||
if ($driver === 'mysql') {
|
||||
DB::statement('ALTER TABLE devices MODIFY album_storage TINYINT(1) NOT NULL DEFAULT 1');
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user