2022-09-20 19:59:52 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
2023-11-15 09:55:31 +00:00
|
|
|
use Illuminate\Database\Query\Expression;
|
2022-09-20 19:59:52 +00:00
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
2023-11-16 11:28:04 +00:00
|
|
|
use Illuminate\Support\Facades\DB;
|
2022-09-20 19:59:52 +00:00
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
|
|
|
|
return new class extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
2023-11-16 11:28:04 +00:00
|
|
|
$driver = DB::getDriverName();
|
|
|
|
|
|
|
|
Schema::table('forms', function (Blueprint $table) use ($driver) {
|
|
|
|
if ($driver === 'mysql') {
|
|
|
|
$table->jsonb('removed_properties')->default(new Expression("(JSON_ARRAY())"));
|
|
|
|
} else {
|
|
|
|
$table->jsonb('removed_properties')->default("[]");
|
|
|
|
}
|
2022-09-20 19:59:52 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::table('forms', function (Blueprint $table) {
|
|
|
|
$table->dropColumn('removed_properties');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|