123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?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::disableForeignKeyConstraints();
-
- Schema::create('news', function (Blueprint $table) {
- $table->id();
- $table->unsignedBigInteger('news_category_id')->index();
- $table->foreign('news_category_id')->references('id')->on('news_categories')->comment('文章類別');
- $table->string('news_img_pc')->nullable()->comment('列表圖 PC');
- $table->string('news_img_mobile')->nullable()->comment('列表圖 MOBILE');
- $table->json('title')->comment("標題");
- $table->json('description')->comment("短文");
- $table->json('written_by')->comment("編輯人");
- $table->dateTime('post_date')->comment("文章發布日");
- $table->string('meta_img')->nullable()->comment('seo image');
- $table->json("meta_title")->nullable()->comment("seo title");
- $table->json("meta_keyword")->nullable()->comment("seo keyword");
- $table->json("meta_description")->nullable()->comment("seo description");
- $table->boolean('on_top')->default(0)->comment("置頂");
- $table->boolean('visible')->default(1)->comment("顯示/隱藏");
- $table->unsignedInteger('order')->default(0)->comment("排序");
- $table->timestamps();
- $table->softDeletes();
- });
-
- Schema::enableForeignKeyConstraints();
- }
-
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::dropIfExists('news');
- }
- };
|