30 lines
906 B
PHP
30 lines
906 B
PHP
<?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
|
|
{
|
|
Schema::create('tables', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('source_database_id')->constrained('source_databases')->cascadeOnDelete();
|
|
$table->string('schema_name')->default('public');
|
|
$table->string('table_name');
|
|
$table->text('comment')->nullable();
|
|
$table->json('options')->nullable();
|
|
$table->timestamp('last_checked_at')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->unique(['source_database_id', 'schema_name', 'table_name'], 'unique_table');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('tables');
|
|
}
|
|
};
|