Skip to content

Function: rbacMigration() ​

ts
function rbacMigration(options?): new () => RbacTypeormMigration;

Defined in: packages/typeorm/src/index.ts:103

A TypeORM migration class that creates the five rbac tables (and their indexes), like createRbacTables of the Kysely package. Add it to the DataSource's migrations and run typeorm migration:run.

ts
new DataSource({ ..., migrations: [rbacMigration(), ...yourMigrations] })

Parameters ​

ParameterType
options?RbacTypeormMigrationOptions & Pick<RbacMigrationOptions, "expiry">

Returns ​

new () => RbacTypeormMigration

Released under the MIT License. Inspired by spatie/laravel-permission.