40 lines
1.3 KiB
PHP
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');
|
|
}
|
|
};
|