mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
Docker, update readme, update dependencies
This commit is contained in:
parent
2398199740
commit
adbcb67f03
30 changed files with 1202 additions and 1744 deletions
19
server/db/init.js
Normal file
19
server/db/init.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
const config = require('./knexfile');
|
||||
const knex = require('knex')(config);
|
||||
|
||||
(async function () {
|
||||
try {
|
||||
const exists = await knex.schema.hasTable(config.migrations.tableName);
|
||||
|
||||
if (!exists) {
|
||||
await knex.migrate.latest();
|
||||
await knex.seed.run();
|
||||
}
|
||||
} catch (error) {
|
||||
process.exitCode = 1;
|
||||
|
||||
throw error;
|
||||
} finally {
|
||||
knex.destroy();
|
||||
}
|
||||
})();
|
|
@ -1,15 +1,15 @@
|
|||
const path = require('path');
|
||||
const _ = require('lodash');
|
||||
|
||||
require('dotenv').config({
|
||||
path: path.resolve(__dirname, '../.env')
|
||||
});
|
||||
|
||||
// Update with your config settings.
|
||||
|
||||
module.exports = {
|
||||
client: 'pg',
|
||||
connection: process.env.DATABASE_URL,
|
||||
migrations: {
|
||||
tableName: 'migration'
|
||||
}
|
||||
},
|
||||
wrapIdentifier: (value, origImpl) => origImpl(_.snakeCase(value))
|
||||
};
|
||||
|
|
|
@ -4,13 +4,11 @@ exports.seed = function(knex) {
|
|||
const date = new Date().toUTCString();
|
||||
|
||||
return knex('user').insert({
|
||||
/* eslint-disable camelcase */
|
||||
email: 'demo@demo.demo',
|
||||
password: bcrypt.hashSync('demo', 10),
|
||||
is_admin: true,
|
||||
isAdmin: true,
|
||||
name: 'Demo Demo',
|
||||
created_at: date,
|
||||
updated_at: date
|
||||
/* eslint-enable camelcase */
|
||||
createdAt: date,
|
||||
updatedAt: date
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue