forked from db-migrate/node-db-migrate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
20 lines (17 loc) · 627 Bytes
/
index.js
File metadata and controls
20 lines (17 loc) · 627 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var driver = require('./lib/driver');
var Migrator = require('./lib/migrator');
exports.dataType = require('./lib/data_type');
exports.config = require('./lib/config');
exports.connect = function(config, callback) {
driver.connect(config, function(err, db) {
if (err) { callback(err); return; }
callback(null, new Migrator(db, config['migrations-dir']));
});
};
exports.createMigration = function(title, migrationsDir, callback) {
var migration = new Migration(title, migrationsDir, new Date());
migration.write(function(err) {
if (err) { callback(err); return; }
callback(null, migration);
});
};