feat(database): remove 'database_rules' from WebsiteTypeExtra configurations and related tests
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('website_type_extras')
|
||||
->select(['id', 'config_schema'])
|
||||
->orderBy('id')
|
||||
->each(function (object $definition): void {
|
||||
$schema = json_decode($definition->config_schema, true);
|
||||
|
||||
if (! is_array($schema) || ! array_key_exists('database_rules', $schema)) {
|
||||
return;
|
||||
}
|
||||
|
||||
unset($schema['database_rules']);
|
||||
|
||||
DB::table('website_type_extras')
|
||||
->where('id', $definition->id)
|
||||
->update(['config_schema' => json_encode($schema)]);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// Removed rules cannot be reconstructed generically.
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user