2025_08_08_101413_create_cities_table.php 901 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. use App\Database\Migrations\TenantMigration;
  6. return new class extends TenantMigration
  7. {
  8. /**
  9. * Run the migrations.
  10. */
  11. public function up(): void
  12. {
  13. Schema::create('cities', function (Blueprint $table) {
  14. $table->id();
  15. $table->unsignedBigInteger('country_id')->nullable();
  16. $table->foreign('country_id')->nullable()->references('id')->on('countries')->onUpdate('cascade')->onDelete('cascade');
  17. $table->string('name');
  18. $table->boolean('enabled')->default(1);
  19. $table->softDeletes();
  20. $table->timestamps();
  21. });
  22. }
  23. /**
  24. * Reverse the migrations.
  25. */
  26. public function down(): void
  27. {
  28. Schema::dropIfExists('cities');
  29. }
  30. };