mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 19:14:04 +00:00
* removed `cascade` on delete for domains * removed only `onDelete` cascade * keep impersonation migrations unchanged * domains set null on delete * Update 2019_09_15_000020_create_domains_table.php * Added DeleteDomain Job while deleting tenant. * Update assets/TenancyServiceProvider.stub.php Co-authored-by: Samuel Štancl <samuel@archte.ch> * renamed class * Update DeleteDomains.php * onDelete restrict * revert nullable * removed `shouldQueue` interface * Update TenancyServiceProvider.stub.php * fetch and delete domains individually * Update DeleteDomains.php * tests for `DeleteDomains` job Co-authored-by: Samuel Štancl <samuel@archte.ch>
37 lines
821 B
PHP
37 lines
821 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateDomainsTable 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('tenant_id');
|
|
|
|
$table->timestamps();
|
|
$table->foreign('tenant_id')->references('id')->on('tenants')->onUpdate('cascade');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('domains');
|
|
}
|
|
}
|