zu fabricjs gewechselt, noch nicht funktionsfähig
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (Schema::hasTable('task_collections') && ! Schema::hasColumn('task_collections', 'source_collection_id')) {
|
||||
Schema::table('task_collections', function (Blueprint $table) {
|
||||
$table->foreignId('source_collection_id')
|
||||
->nullable()
|
||||
->after('event_type_id')
|
||||
->constrained('task_collections')
|
||||
->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasTable('tasks')) {
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('tasks', 'source_collection_id')) {
|
||||
$table->foreignId('source_collection_id')
|
||||
->nullable()
|
||||
->after('collection_id')
|
||||
->constrained('task_collections')
|
||||
->nullOnDelete();
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('tasks', 'source_task_id')) {
|
||||
$table->foreignId('source_task_id')
|
||||
->nullable()
|
||||
->after('tenant_id')
|
||||
->constrained('tasks')
|
||||
->nullOnDelete();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (Schema::hasTable('tasks')) {
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('tasks', 'source_collection_id')) {
|
||||
$table->dropForeign(['source_collection_id']);
|
||||
$table->dropColumn('source_collection_id');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('tasks', 'source_task_id')) {
|
||||
$table->dropForeign(['source_task_id']);
|
||||
$table->dropColumn('source_task_id');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasTable('task_collections') && Schema::hasColumn('task_collections', 'source_collection_id')) {
|
||||
Schema::table('task_collections', function (Blueprint $table) {
|
||||
$table->dropForeign(['source_collection_id']);
|
||||
$table->dropColumn('source_collection_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user