Umzug MySQL Storage
Custom storage engine for Umzug to store migrations history in MySQL.
Why?
- Inception; it allows you to store migration logs within the same MySQL database you are migrating;
- Umzug's default JSON storage engine produces a local JSON file that does not persist with ephemeral file-systems, such as Heroku;
- Makes team collaboration easier with devs that use the same db server.
Installation
$ npm install umzug-mysql-storage
Requirements
- Node.js v.4+
- MySQL v.5+
Quick start
Install umzug-mysql-storage
and umzug
v.2+, which is listed as a peer dependency.
$ npm install umzug-mysql-storage --save
$ npm install umzug --save
Setup storage engine with umzug.
const path = ;const Umzug = ;const MySQLStorage = ; const umzug = storage: database: 'foo' table: 'migration' // will be automatically created column: 'name' // optional host: 'localhost' port: 3306 user: 'root' password: '' // ... specify additional umzug options - if any;
Storage properties
database
(string) the name of the database to store migration logs into (required).table
(string) the name of the table to store migration logs into; defaults to "migration" (optional).column
(string) the name of the column to store migration logs into; defaults to "name" (optional).host
(string) mysql server hostname (optional; defaults to "localhost").port
(integer) mysql server port (optional; defaults to 3306).user
(string) mysql server username (optional; defaults to "root").password
(string) mysql server password (optional; defaults to empty string).
Contribute
Source code contributions are most welcome. The following rules apply:
- Follow the Airbnb Style Guide;
- Make sure not to break the tests.