1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 20:34:03 +00:00

Fix Postgres test

This commit is contained in:
lukinovec 2023-05-10 12:27:28 +02:00
parent fb042a0671
commit 0f921c1362

View file

@ -76,11 +76,6 @@ beforeEach(function () {
}); });
}); });
afterEach(function () {
Schema::dropIfExists('uuid_comments');
Schema::dropIfExists('uuid_posts');
});
test('postgres user can get created using the job', function() { test('postgres user can get created using the job', function() {
$tenant = Tenant::create(); $tenant = Tenant::create();
$name = $tenant->getTenantKey(); $name = $tenant->getTenantKey();
@ -203,7 +198,7 @@ trait UsesUuidAsPrimaryKey
class UuidPost extends Model class UuidPost extends Model
{ {
use BelongsToTenant; use UsesUuidAsPrimaryKey, BelongsToTenant;
public $incrementing = false; public $incrementing = false;
public $table = 'uuid_posts'; public $table = 'uuid_posts';
@ -221,20 +216,10 @@ class UuidPost extends Model
} }
} }
class UuidScopedComment extends UuidComment
{
use BelongsToPrimaryModel;
protected $guarded = [];
public function getRelationshipToPrimaryModel(): string
{
return 'uuid_post';
}
}
class UuidComment extends Model class UuidComment extends Model
{ {
use UsesUuidAsPrimaryKey;
protected $guarded = []; protected $guarded = [];
protected $keyType = 'string'; protected $keyType = 'string';
@ -246,3 +231,15 @@ class UuidComment extends Model
return $this->belongsTo(UuidPost::class); return $this->belongsTo(UuidPost::class);
} }
} }
class UuidScopedComment extends UuidComment
{
use UsesUuidAsPrimaryKey, BelongsToPrimaryModel;
protected $guarded = [];
public function getRelationshipToPrimaryModel(): string
{
return 'uuid_post';
}
}