From 19e965a77a6e5040d2ca6ad3c9a565408c5910fe Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Thu, 26 Apr 2018 13:50:35 +0700 Subject: SEMICOLONS, ermahgerd (#93) --- database/db.js | 64 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'database') diff --git a/database/db.js b/database/db.js index 40c6e13..8655f76 100644 --- a/database/db.js +++ b/database/db.js @@ -2,52 +2,52 @@ let init = function(db){ // Create the tables we need to store galleries and files db.schema.createTableIfNotExists('albums', function (table) { - table.increments() - table.integer('userid') - table.string('name') - table.string('identifier') - table.integer('enabled') - table.integer('timestamp') + table.increments(); + table.integer('userid'); + table.string('name'); + table.string('identifier'); + table.integer('enabled'); + table.integer('timestamp'); table.integer('editedAt'); table.integer('zipGeneratedAt'); - }).then(() => {}) + }).then(() => {}); db.schema.createTableIfNotExists('files', function (table) { - table.increments() - table.integer('userid') - table.string('name') - table.string('original') - table.string('type') - table.string('size') - table.string('hash') - table.string('ip') - table.integer('albumid') - table.integer('timestamp') - }).then(() => {}) + table.increments(); + table.integer('userid'); + table.string('name'); + table.string('original'); + table.string('type'); + table.string('size'); + table.string('hash'); + table.string('ip'); + table.integer('albumid'); + table.integer('timestamp'); + }).then(() => {}); db.schema.createTableIfNotExists('users', function (table) { - table.increments() - table.string('username') - table.string('password') - table.string('token') - table.integer('enabled') - table.integer('timestamp') + table.increments(); + table.string('username'); + table.string('password'); + table.string('token'); + table.integer('enabled'); + table.integer('timestamp'); }).then(() => { db.table('users').where({username: 'root'}).then((user) => { - if(user.length > 0) return + if(user.length > 0) return; require('bcrypt').hash('root', 10, function(err, hash) { - if(err) console.error('Error generating password hash for root') + if(err) console.error('Error generating password hash for root'); db.table('users').insert({ username: 'root', password: hash, token: require('randomstring').generate(64), timestamp: Math.floor(Date.now() / 1000) - }).then(() => {}) - }) - }) - }) -} + }).then(() => {}); + }); + }); + }); +}; -module.exports = init +module.exports = init; -- cgit v1.2.3