test: seeding during migration
This commit is contained in:
parent
9a0e6f9640
commit
acc7da5310
|
@ -1,8 +1,23 @@
|
||||||
|
const Util = require('../../utils/Util');
|
||||||
|
|
||||||
exports.up = async knex => {
|
exports.up = async knex => {
|
||||||
await knex.schema.createTable('settings', table => {
|
await knex.schema.createTable('settings', table => {
|
||||||
table.string('key');
|
table.string('key');
|
||||||
table.string('value');
|
table.string('value');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const defaults = Util.getEnvironmentDefaults();
|
||||||
|
const keys = Object.keys(defaults);
|
||||||
|
for (const item of keys) {
|
||||||
|
await Util.writeConfigToDb({
|
||||||
|
key: item,
|
||||||
|
value: defaults[item]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.down = async knex => {
|
exports.down = async knex => {
|
||||||
|
|
Loading…
Reference in New Issue