aboutsummaryrefslogtreecommitdiff
path: root/database
diff options
context:
space:
mode:
authorPitu <[email protected]>2018-09-16 00:39:58 -0300
committerPitu <[email protected]>2018-09-16 00:39:58 -0300
commit868f4a64eca3fb38fbfa12e7b9a9d0d4a374f369 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /database
parentMerge pull request #149 from iilukas/patch-1 (diff)
downloadhost.fuwn.me-868f4a64eca3fb38fbfa12e7b9a9d0d4a374f369.tar.xz
host.fuwn.me-868f4a64eca3fb38fbfa12e7b9a9d0d4a374f369.zip
Begone!
Diffstat (limited to 'database')
-rw-r--r--database/db.js53
-rw-r--r--database/migration.js13
2 files changed, 0 insertions, 66 deletions
diff --git a/database/db.js b/database/db.js
deleted file mode 100644
index 8655f76..0000000
--- a/database/db.js
+++ /dev/null
@@ -1,53 +0,0 @@
-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.integer('editedAt');
- table.integer('zipGeneratedAt');
- }).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(() => {});
-
- db.schema.createTableIfNotExists('users', function (table) {
- 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;
-
- require('bcrypt').hash('root', 10, function(err, hash) {
- 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(() => {});
- });
- });
- });
-};
-
-module.exports = init;
diff --git a/database/migration.js b/database/migration.js
deleted file mode 100644
index 6194091..0000000
--- a/database/migration.js
+++ /dev/null
@@ -1,13 +0,0 @@
-const config = require('../config.js');
-const db = require('knex')(config.database);
-
-const migration = {};
-migration.start = async () => {
- await db.schema.table('albums', table => {
- table.integer('editedAt');
- table.integer('zipGeneratedAt');
- });
- console.log('Migration finished! Now start lolisafe normally');
-};
-
-migration.start();