sequelize-migreat v4.3.0
Migreat
Migreat makes migrations with Sequelize models easy. You define a schema with models and associations using a Migreat interface. Migreat generates Typescript migration files.
Defining Schema's, Models and Associations
Define a model as follows:
const model = Migreat.defineModel<ModelType>({
name: 'table name',
attributes: {
key: Migreat.Attr.uuid()
},
associations: {
key: Migreat.Assoc.belongsTo(OtherModel, { localKey: string })
}
})
Attributes and association types described in .. ?
A schema is simply a set of models, defined like so:
const schemaDef = new Migreat.SchemaDef([modelA, modelB, ...])
Generate Migrations
Migrations are sorted by ascending name.
Generating a migration from a schema definition
To generate the first migration from a schema definition, do:
Migreat.generateMigrationFromSchema(schemaDef): Migration
Generating a migration from migrations
To generate subsequent migrations, do:
Migreat.generateMigrationFromMigration(migration, targetSchemaDef): Migration
Execute
To execute a migration, do
Migreat.executeMigration(migration, dbConfig)
5 months ago
5 months ago
5 months ago
7 months ago
8 months ago
10 months ago
8 months ago
8 months ago
10 months ago
10 months ago
10 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago