1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/migrator.js

18 lines
443 B
JavaScript
Raw Normal View History

'use strict';
const DBMigrate = require('db-migrate');
const path = require('path');
2016-11-12 11:21:40 +01:00
const parseDbUrl = require('parse-database-url');
2016-11-12 11:21:40 +01:00
function migrateDb (dbUrl, schema = "public") {
const custom = parseDbUrl(dbUrl);
custom.schema = schema;
const dbmigrate = DBMigrate.getInstance(true, {
2016-11-10 21:15:16 +01:00
cwd: __dirname,
2016-11-12 11:21:40 +01:00
config: { custom },
env: 'custom' }
);
return dbmigrate.up();
}
2016-11-10 21:15:16 +01:00
module.exports = migrateDb;