2025_11_28_043727_create_albums_table.php 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. */
  10. public function up(): void
  11. {
  12. Schema::disableForeignKeyConstraints();
  13. Schema::create('albums', function (Blueprint $table) {
  14. $table->id();
  15. $table->unsignedBigInteger('album_category_id')->index();
  16. $table->foreign('album_category_id')->references('id')->on('album_categories')->comment('類別');
  17. $table->string('news_img_pc')->comment('列表圖 PC');
  18. $table->string('news_img_mobile')->comment('列表圖 MOBILE');
  19. $table->string('title')->comment("標題");
  20. $table->dateTime('post_date')->comment("文章發布日");
  21. $table->unsignedTinyInteger('upload_type')->comment('上傳類型 1.url 2.upload files');
  22. $table->string('link')->comment('連結網址');
  23. $table->string('meta_img')->nullable()->comment('seo image');
  24. $table->string("meta_title")->comment("seo title");
  25. $table->string("meta_description")->comment("seo description");
  26. $table->boolean('on_top')->default(0)->comment("置頂");
  27. $table->boolean('visible')->default(1)->comment("顯示/隱藏");
  28. $table->unsignedInteger('order')->default(0)->comment("排序");
  29. $table->timestamps();
  30. $table->softDeletes();
  31. });
  32. Schema::enableForeignKeyConstraints();
  33. }
  34. /**
  35. * Reverse the migrations.
  36. */
  37. public function down(): void
  38. {
  39. Schema::dropIfExists('albums');
  40. }
  41. };