-
Notifications
You must be signed in to change notification settings - Fork 3
fix: scope yates roles to active database #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: scope yates roles to active database #127
Conversation
|
Published beta package version: |
b34c418 to
0b6a4f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds database scoping to Yates roles to support multi-tenant setups where multiple Prisma clients connect to different databases on the same server. The changes ensure that role and ability identifiers include the database name to prevent collisions between tenants.
Key changes:
- Database scope is determined during initialization by querying the current database name
- Role and ability identifiers now include the database scope as a prefix to avoid naming conflicts
- Setup process initializes the database scope before creating roles or granting permissions
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.ts | Refactored role management into a Yates class with database scoping support; moved utility functions to instance methods |
| test/integration/multi-tenant-db.spec.ts | Added integration test verifying isolation between tenants using different databases |
| prisma/schema2.prisma | Added second Prisma schema for multi-tenant testing with subset of models |
| package.json | Updated setup script to generate and migrate both schemas |
| docker-compose.yml | Configured second database instance for multi-tenant testing |
| docker-init/setup-databases.sh | Added script to create multiple PostgreSQL databases during Docker initialization |
| biome.json | Excluded generated Prisma client files from linting |
| prisma/migrations/20251115091853_init/migration.sql | Migration file removing unused tables from schema |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| }; | ||
|
|
||
| const createRoleName = this.createRoleName.bind(this); |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This binding appears unnecessary since createRoleName is already an arrow function property of the class, which automatically binds this. The variable is also unused in the subsequent code.
| const createRoleName = this.createRoleName.bind(this); |
85e073c to
11ec72b
Compare
73e1cf6 to
6a5a627
Compare
6a5a627 to
6a97f46
Compare
|


Summary
Testing
Codex Task