dym-sh/database/migrations/2024_08_09_112756_create_ar...

39 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2024-08-09 13:52:23 +02:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('articles', function (Blueprint $table) {
$table->id();
2024-08-11 11:53:49 +02:00
$table->string('slug')->unique();
2024-08-09 13:52:23 +02:00
$table->string('title');
$table->text('body');
2024-08-11 11:53:49 +02:00
$table->integer('user_id')->references('id')->on('users');
$table->integer('category')->references('id')->on('categories');
2024-08-09 13:52:23 +02:00
$table->boolean('is_collection');
2024-08-11 11:53:49 +02:00
$table->integer('tag_1')->references('id')->on('tags');
$table->integer('tag_2')->references('id')->on('tags');
$table->integer('tag_3')->references('id')->on('tags');
$table->integer('tag_4')->references('id')->on('tags');
$table->integer('tag_5')->references('id')->on('tags');
2024-08-09 13:52:23 +02:00
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('articles');
}
};