SchemaGenerator
Hierarchy
- AbstractSchemaGenerator<AbstractSqlDriver>
- SchemaGenerator
Index
Constructors
constructor
Parameters
em: EntityManager<IDatabaseDriver<Connection>> | AbstractSqlDriver<AbstractSqlConnection, AbstractSqlPlatform>
Returns SchemaGenerator
Methods
clearDatabase
Parameters
optionaloptions: { schema?: string; truncate?: boolean }
optionalschema: string
optionaltruncate: boolean
Returns Promise<void>
createDatabase
creates new database and connects to it
Parameters
name: string
Returns Promise<void>
createSchema
Parameters
optionaloptions: { schema?: string; wrap?: boolean }
optionalschema: string
optionalwrap: boolean
Returns Promise<void>
diffToSQL
Parameters
schemaDiff: SchemaDifference
options: { dropTables?: boolean; safe?: boolean; schema?: string; wrap?: boolean }
optionaldropTables: boolean
optionalsafe: boolean
optionalschema: string
optionalwrap: boolean
Returns Promise<string>
dropDatabase
Parameters
optionalname: string
Returns Promise<void>
dropSchema
Parameters
options: { dropDb?: boolean; dropMigrationsTable?: boolean; schema?: string; wrap?: boolean } = {}
optionaldropDb: boolean
optionaldropMigrationsTable: boolean
optionalschema: string
optionalwrap: boolean
Returns Promise<void>
ensureDatabase
Returns true if the database was created.
Returns Promise<boolean>
ensureIndexes
Returns Promise<void>
execute
Parameters
sql: string
options: { wrap?: boolean } = {}
optionalwrap: boolean
Returns Promise<undefined>
generate
Returns Promise<string>
getCreateSchemaSQL
Parameters
options: { schema?: string; wrap?: boolean } = {}
optionalschema: string
optionalwrap: boolean
Returns Promise<string>
getDropSchemaSQL
Parameters
options: { dropMigrationsTable?: boolean; schema?: string; wrap?: boolean } = {}
optionaldropMigrationsTable: boolean
optionalschema: string
optionalwrap: boolean
Returns Promise<string>
getTargetSchema
Parameters
optionalschema: string
Returns DatabaseSchema
getUpdateSchemaMigrationSQL
Parameters
options: { dropTables?: boolean; fromSchema?: DatabaseSchema; safe?: boolean; schema?: string; wrap?: boolean } = {}
optionaldropTables: boolean
optionalfromSchema: DatabaseSchema
optionalsafe: boolean
optionalschema: string
optionalwrap: boolean
Returns Promise<{ down: string; up: string }>
getUpdateSchemaSQL
Parameters
options: { dropTables?: boolean; fromSchema?: DatabaseSchema; safe?: boolean; schema?: string; wrap?: boolean } = {}
optionaldropTables: boolean
optionalfromSchema: DatabaseSchema
optionalsafe: boolean
optionalschema: string
optionalwrap: boolean
Returns Promise<string>
refreshDatabase
Returns Promise<void>
updateSchema
Parameters
options: { dropTables?: boolean; fromSchema?: DatabaseSchema; safe?: boolean; schema?: string; wrap?: boolean } = {}
optionaldropTables: boolean
optionalfromSchema: DatabaseSchema
optionalsafe: boolean
optionalschema: string
optionalwrap: boolean
Returns Promise<void>
staticregister
Parameters
orm: MikroORM<IDatabaseDriver<Connection>>
Returns void
Should be renamed to
SqlSchemaGenerator
in v6