SQLMigrator.migrate()method
Bring the provider's tables into line with the given collection schemas by running the generated migrations.
migrate(...collections: Collections<number>): Promise<void>
new SQLMigrator<T>()
| Return | |
|---|---|
SQLMigrator<T> | Shared SQL migration logic that diffs collection schemas against live tables to produce migration statements. |
Shared SQL migration logic that diffs collection schemas against live tables to produce migration statements.
const migrator = new SQLiteMigrator(provider); await migrator.migrate(users, posts);
Bring the provider's tables into line with the given collection schemas by running the generated migrations.
migrate(...collections: Collections<number>): Promise<void>
Compute the SQL statements needed to bring the tables into line with the given collection schemas, without executing them.
getMigrations(...collections: Collections<number>): Promise<readonly string[]>
Build the CREATE TABLE statement for a collection, including its ID, data, and generated columns.
getCreateTableQuery(collection: Collection<string, number, T>): string
Get the full set of columns for a collection's table: the ID column, data column, and generated columns.
getCreateTableColumns(collection: Collection<string, number, T>): readonly SQLTableColumn[]
Get the generated (computed) columns for a collection's table, derived from its schema's scalar properties.
getGeneratedTableColumns(collection: Collection<string, number, T>): readonly SQLTableColumn[]