AQ update

This commit is contained in:
peter
2020-08-13 12:03:35 +02:00
parent bd5b33e4a1
commit 7c1b0b73ed
35 changed files with 1343 additions and 881 deletions
@@ -11,28 +11,20 @@ exports.up = function (knex) {
output: process.stdout
})
return new Promise((res, rej) => {
r1.question('WARNING\n\nAbout to update your signups table. Please make sure there are no active signups. \nContinue? y/N', answer => {
if(!answer || answer === "" || answer === "n" || answer === "N"){
rej(new Error("User aborted"))
}else{
knex('signups').select('*').then(rows => {
return knex.schema.dropTable('signups').then(_ => {
return knex.schema.createTable('signups', function (table) {
table.increments('id').primary()
table.unique(['raidid', 'characterid'])
table.integer('raidid')
table.foreign('raidid').references('id').inTable('raids').onDelete('CASCADE')
table.integer('characterid')
table.foreign('characterid').references('id').inTable('characters').onDelete('CASCADE')
table.boolean('benched').defaultTo('false')
table.boolean('late')
table.timestamp('timestamp').defaultTo(knex.fn.now())
table.string('memo').nullable()
res()
}).catch(rej)
})
})
}
return knex.schema.dropTable('signups').then(_ => {
return knex.schema.createTable('signups', function (table) {
table.increments('id').primary()
table.unique(['raidid', 'characterid'])
table.integer('raidid')
table.foreign('raidid').references('id').inTable('raids').onDelete('CASCADE')
table.integer('characterid')
table.foreign('characterid').references('id').inTable('characters').onDelete('CASCADE')
table.boolean('benched').defaultTo('false')
table.boolean('late')
table.timestamp('timestamp').defaultTo(knex.fn.now())
table.string('memo').nullable()
res()
}).catch(rej)
})
})
}
+1 -1
View File
@@ -12,7 +12,7 @@ exports.up = function (knex) {
exports.down = function (knex) {
return knex.schema.table('signups', function (table) {
return knex.schema.table('items', function (table) {
table.dropColumn('stats')
})
}