7fb0512f6529edd9194fe4700f0341eb812ba288
DB Morph
This tool allows a simple DB migration based on SQL and TS files as part of automated CI/CD activities. It also supports seeding database tables.
Syntax
dbmorph migrate|seed|make[:seed] [options]
migrateruns all migrations that have not yet been applied for the current database. It will pull all migrations from thedb/migrationsdirectoryseedruns all (or just the given) seeds. It will pull the seed information from thedb/seedsdirectory.makecreates an empty migration template. If thedb/migrationsdirectory does not exist, it is created. For each migration, an "up" and a "down" file is being generated. "Up" will be used for the migration, whereas "down" is used if the migration fails - in order to roll the changes back in a controlled manner.make:seedcreates a new template for seeding data.
Seed Options
The seed command allows for one option:
dbmorph seed [name]
If name is not provided, all seeds will be run. Otherwise only the seed that
matches the given name. This can also be a partial match.
Make Options
The make command accepts two options:
dbmorph make <name> [ts]|[sql]
The <name> is used to provide a unique human-readable name for the migration.
the ts / sql options determine which type of a migration is supposed to be
created: if ts is provided, a template for a Typescript file will be created,
otherwise an empty SQL file is provided.
make:seed Options
The make:seed command accepts one option:
dbmorph make:seed <name>
The <name> is used to provide a unique human-readable name for the seed.
Description
Languages
TypeScript
100%