1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 14:34:04 +00:00

Fix #998, properly replace ALL tenant_id literals

This commit is contained in:
Samuel Štancl 2022-11-10 16:44:52 +01:00
parent 8a00a105d0
commit 2a39b0526a
11 changed files with 35 additions and 22 deletions

View file

@ -14,7 +14,7 @@ return [
'domain' => Stancl\Tenancy\Database\Models\Domain::class,
/**
* Name of the column used to for ->tenant() relationships.
* Name of the column used to relate models to tenants.
*
* This is used by the HasDomains trait, and models that use the BelongsToTenant trait (used in single-database tenancy).
*/

View file

@ -5,6 +5,7 @@ declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Stancl\Tenancy\Tenancy;
class CreateTenantUserImpersonationTokensTable extends Migration
{
@ -17,13 +18,13 @@ class CreateTenantUserImpersonationTokensTable extends Migration
{
Schema::create('tenant_user_impersonation_tokens', function (Blueprint $table) {
$table->string('token', 128)->primary();
$table->string('tenant_id');
$table->string(Tenancy::tenantKeyColumn());
$table->string('user_id');
$table->string('auth_guard');
$table->string('redirect_url');
$table->timestamp('created_at');
$table->foreign('tenant_id')->references('id')->on('tenants')->onUpdate('cascade')->onDelete('cascade');
$table->foreign(Tenancy::tenantKeyColumn())->references('id')->on('tenants')->onUpdate('cascade')->onDelete('cascade');
});
}

View file

@ -5,6 +5,7 @@ declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Stancl\Tenancy\Tenancy;
class CreateDomainsTable extends Migration
{
@ -18,10 +19,10 @@ class CreateDomainsTable extends Migration
Schema::create('domains', function (Blueprint $table) {
$table->increments('id');
$table->string('domain', 255)->unique();
$table->string('tenant_id');
$table->string(Tenancy::tenantKeyColumn());
$table->timestamps();
$table->foreign('tenant_id')->references('id')->on('tenants')->onUpdate('cascade');
$table->foreign(Tenancy::tenantKeyColumn())->references('id')->on('tenants')->onUpdate('cascade');
});
}