Files
timebank-cc-public/database/migrations/2026_03_10_030000_create_calls_tables.php
Ronald Huynen 2547717edb Initial commit
2026-03-23 21:37:59 +01:00

40 lines
1.3 KiB
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('calls', function (Blueprint $table) {
$table->id();
$table->morphs('callable');
$table->unsignedBigInteger('tag_id')->nullable();
$table->foreign('tag_id')->references('tag_id')->on('taggable_tags')->nullOnDelete();
$table->unsignedBigInteger('location_id')->nullable();
$table->foreign('location_id')->references('id')->on('locations')->nullOnDelete();
$table->dateTime('from');
$table->dateTime('till')->nullable();
$table->timestamps();
$table->softDeletes();
});
Schema::create('call_translations', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('call_id');
$table->foreign('call_id')->references('id')->on('calls')->cascadeOnDelete();
$table->string('locale', 5);
$table->text('content')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('call_translations');
Schema::dropIfExists('calls');
}
};