7.0.0 • Published 4 months ago

sequelize-migreat v7.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

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)
7.0.0

4 months ago

4.5.0

8 months ago

4.6.0

7 months ago

4.4.0

12 months ago

4.3.0

2 years ago

4.2.2

2 years ago

4.2.0

2 years ago

4.1.0

2 years ago

4.0.5

2 years ago

4.0.4

2 years ago

4.0.7

2 years ago

4.0.6

2 years ago

4.0.0

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

1.9.1

3 years ago

1.8.2

3 years ago

1.5.5

3 years ago

1.9.0

3 years ago

1.8.1

3 years ago

1.5.4

3 years ago

1.8.0

3 years ago

1.5.3

3 years ago

1.7.0

3 years ago

1.5.2

3 years ago

1.6.0

3 years ago

1.5.1

3 years ago

1.4.2

3 years ago

1.5.0

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.8.6

3 years ago

1.8.5

3 years ago

1.8.4

3 years ago

1.8.3

3 years ago

1.5.6

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.1

3 years ago