mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 17:54:03 +00:00
When a foreign key has no-rls comment (or no comment when scopeByDefault is false), skip path generation earlier
This commit is contained in:
parent
27685ffe5a
commit
2197214516
2 changed files with 20 additions and 9 deletions
|
|
@ -650,6 +650,19 @@ test('table manager throws an exception when encountering a recursive relationsh
|
|||
expect(fn () => app(TableRLSManager::class)->generateTrees())->toThrow(RecursiveRelationshipException::class);
|
||||
});
|
||||
|
||||
test('table manager ignores recursive relationship if the foreign key responsible for the recursion has no-rls comment', function() {
|
||||
Schema::create('recursive_posts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('highlighted_comment_id')->nullable()->comment('no-rls')->constrained('comments');
|
||||
});
|
||||
|
||||
Schema::table('comments', function (Blueprint $table) {
|
||||
$table->foreignId('recursive_post_id')->comment('rls')->constrained('recursive_posts');
|
||||
});
|
||||
|
||||
expect(fn () => app(TableRLSManager::class)->generateTrees())->not()->toThrow(RecursiveRelationshipException::class);
|
||||
});
|
||||
|
||||
class Post extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue