2026_03_04_111111_create_countries_table.php 926 B

123456789101112131415161718192021222324252627282930313233
  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::create('countries', function (Blueprint $table) {
  13. $table->id();
  14. $table->string('name', 100)->comment('国家/地区名称');
  15. $table->string('code', 2)->unique()->comment('国家/地区代码(2位字母)');
  16. $table->string('flag', 255)->comment('国旗图标URL');
  17. $table->integer('status')->nullable()->default(1)->comment('状态: 1-正常, 0-禁用');
  18. $table->timestamps();
  19. $table->comment('国家/地区表');
  20. });
  21. }
  22. /**
  23. * Reverse the migrations.
  24. */
  25. public function down(): void
  26. {
  27. Schema::dropIfExists('countries');
  28. }
  29. };