Changelog - 2026-05-22
Schema-Qualified Casbin Tables
Breaking ChangeIn one line. DrizzleCasbinAdapter now targets a specific Postgres schema for its tables instead of relying on the connection's search_path.
What changed
- Per-entity
schemaName. Each entity (permission,role,policyDefinition) accepts an optionalschemaName, defaultpublic. The three tables can live in different schemas. - Qualified SQL. Queries now read
"<schema>"."<table>"instead of a bare table name.
Who is affected
- Casbin tables in the
publicschema. No action needed. - Casbin tables in another schema that relied on
search_path. Queries fail to resolve the table until you setschemaName.
Breaking changes
WARNING
Only affects deployments whose Casbin tables live outside the public schema and relied on search_path.
Before (resolved via search_path):
typescript
new DrizzleCasbinAdapter({
dataSource,
entities: {
permission: { tableName: 'permissions', principalType: 'Permission' },
role: { tableName: 'roles', principalType: 'Role' },
policyDefinition: { tableName: 'policy_definitions', principalType: 'PolicyDefinition' },
},
});After (explicit schema):
typescript
new DrizzleCasbinAdapter({
dataSource,
entities: {
permission: { schemaName: 'auth', tableName: 'permissions', principalType: 'Permission' },
role: { schemaName: 'auth', tableName: 'roles', principalType: 'Role' },
policyDefinition: {
schemaName: 'auth',
tableName: 'policy_definitions',
principalType: 'PolicyDefinition',
},
},
});Migration step: add schemaName to every entity whose table is not in public.
Details
- The queries only read
policy_definitionsandpermissions, sorole.schemaNameis accepted but does not yet change the SQL.