db-migrate-plugin-sql
v1.0.0
Published
Plain SQL migrations for db-migrate, without any JavaScript.
Maintainers
Readme
db-migrate-plugin-sql
Plain SQL migrations for db-migrate, without any JavaScript.
Installation
$ npm install db-migrate-plugin-sqldb-migrate picks up the plugin from the package.json of your project.
Usage
Create a migration:
$ db-migrate create add-users --sqlThis creates migrations/<timestamp>-add-users.sql. A migration has an up
and an optional down section, each starting with its own line:
-- up
CREATE TABLE users (id int PRIMARY KEY, name text);
-- down
DROP TABLE users;The SQL of a section is run as one statement batch with runSql. Whether
several statements per section work depends on your driver, for mysql enable
multipleStatements in your config.
SQL migrations run just like JavaScript migrations, both kinds can be mixed in one migrations directory.
