mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 22:34:03 +00:00
38 lines
872 B
PHP
38 lines
872 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Stancl\Tenancy\Tenancy;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('domains', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->string('domain', 255)->unique();
|
|
$table->string(Tenancy::tenantKeyColumn());
|
|
|
|
$table->timestamps();
|
|
$table->foreign(Tenancy::tenantKeyColumn())->references('id')->on('tenants')->onUpdate('cascade');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('domains');
|
|
}
|
|
};
|