2019_09_15_000020_create_domains_table.php 842 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. declare(strict_types=1);
  3. use Illuminate\Database\Migrations\Migration;
  4. use Illuminate\Database\Schema\Blueprint;
  5. use Illuminate\Support\Facades\Schema;
  6. class CreateDomainsTable extends Migration
  7. {
  8. /**
  9. * Run the migrations.
  10. *
  11. * @return void
  12. */
  13. public function up(): void
  14. {
  15. Schema::create('domains', function (Blueprint $table) {
  16. $table->increments('id');
  17. $table->string('domain', 255)->unique();
  18. $table->string('tenant_id');
  19. $table->timestamps();
  20. $table->foreign('tenant_id')->references('id')->on('tenants')->onUpdate('cascade')->onDelete('cascade');
  21. });
  22. }
  23. /**
  24. * Reverse the migrations.
  25. *
  26. * @return void
  27. */
  28. public function down(): void
  29. {
  30. Schema::dropIfExists('domains');
  31. }
  32. }