filesafe/database/migration.js
Bobby Wibowo c5b1e26671
Updates
* Adds 'enabled' column into 'users' table with database/migration.js file.

* Ignore errors when adding new columns in database/migration.js. There's a better method by checking whether the columns already exist before adding them, but this will do for now.
2018-03-14 14:12:12 +07:00

18 lines
469 B
JavaScript

const config = require('../config.js')
const db = require('knex')(config.database)
const migration = {}
migration.start = async () => {
await db.schema.table('albums', table => {
table.dateTime('editedAt')
table.dateTime('zipGeneratedAt')
}).catch(() => {})
await db.schema.table('users', table => {
table.integer('enabled')
}).catch(() => {})
console.log('Migration finished! Now start lolisafe normally')
process.exit(0)
}
migration.start()