mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-13 16:06:21 +00:00
c5b1e26671
* 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.
18 lines
469 B
JavaScript
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()
|