hypothetical/database/migrations/2018_04_17_222542_create_blog_table.php

32 lines
773 B
PHP
Raw Permalink Normal View History

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
2022-05-23 21:01:33 -04:00
return new class extends Migration
{
/**
* Run the migrations.
*/
2023-03-13 17:33:19 -04:00
public function up(): void
{
Schema::create('blog', function(Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->string('title')->nullable();
$table->text('body')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
2023-03-13 17:33:19 -04:00
public function down(): void
{
Schema::drop('blog');
}
2022-05-23 21:01:33 -04:00
};