4.3.0 • Published 5 months ago

sequelize-migreat v4.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 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)
4.3.0

5 months ago

4.2.2

5 months ago

4.2.0

5 months ago

4.1.0

7 months ago

4.0.5

8 months ago

4.0.4

10 months ago

4.0.7

8 months ago

4.0.6

8 months ago

4.0.0

10 months ago

4.0.3

10 months ago

4.0.2

10 months ago

1.9.1

2 years ago

1.8.2

2 years ago

1.5.5

2 years ago

1.9.0

2 years ago

1.8.1

2 years ago

1.5.4

2 years ago

1.8.0

2 years ago

1.5.3

2 years ago

1.7.0

2 years ago

1.5.2

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.4.2

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.8.6

2 years ago

1.8.5

2 years ago

1.8.4

2 years ago

1.8.3

2 years ago

1.5.6

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.1

2 years ago