htdocs/laravel php artisan meke:migration create_posts_table
/datebase/migrations/create_posts_table.php public function up() { Schema::create('posts', function (Blueprint $table) { $table->bigIncrements('id'); $table->bigInteger('user_id')->unsigned()->index(); $table->bigInteger('category_id')->unsigned()->index(); $table->string('title')->nullable(); $table->text('content')->nullable(); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade'); $table->timestamps(); }); }
/ php artisan migrate
//テーブル消去 php artisan migrate:refresh /config/database.php 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci',