/** * Run the migrations. * * @return void */ public function up() { Schema::create(\App\Models\ArticlePermalink::getTableName(), function (Blueprint $table) { $table->string('permalink', 255)->primary(); $table->uuid('article_id')->index()->nullable(); $table->dateTime('created_at'); $table->dateTime('updated_at')->nullable(); $table->foreign('article_id')->references('article_id')->on(\App\Models\Article::getTableName())->onDelete('cascade'); }); }
/** * Run the migrations. * * @return void */ public function up() { Schema::create(\App\Models\ArticleMeta::getTableName(), function (Blueprint $table) { $table->uuid('article_id'); $table->string('meta_name', 255); $table->string('meta_content', 255)->nullable(); $table->string('meta_property', 255)->nullable(); $table->dateTime('created_at'); $table->dateTime('updated_at')->nullable(); $table->primary(['article_id', 'meta_name']); $table->foreign('article_id')->references('article_id')->on(\App\Models\Article::getTableName())->onDelete('cascade'); }); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table(\App\Models\Article::getTableName(), function (Blueprint $table) { $table->dropForeign('articles_permalink_foreign'); }); }