aboutsummaryrefslogtreecommitdiff
path: root/database/db.js
diff options
context:
space:
mode:
authorPitu <[email protected]>2017-01-18 02:40:14 -0300
committerPitu <[email protected]>2017-01-18 02:40:14 -0300
commit84ff2241ba81fc6a1a2201074d30f971dad8a0de (patch)
tree8ec712f118fc7e553f170640e3c86760bbd2a2ec /database/db.js
parentBetter static routes (diff)
downloadhost.fuwn.me-84ff2241ba81fc6a1a2201074d30f971dad8a0de.tar.xz
host.fuwn.me-84ff2241ba81fc6a1a2201074d30f971dad8a0de.zip
Shit ton of things on this update
Diffstat (limited to 'database/db.js')
-rw-r--r--database/db.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/database/db.js b/database/db.js
index 6c4889b..b22ce51 100644
--- a/database/db.js
+++ b/database/db.js
@@ -5,7 +5,7 @@ let init = function(db, config){
db.schema.createTableIfNotExists('albums', function (table) {
table.increments()
table.string('name')
- table.timestamps()
+ table.integer('timestamp')
}).then(() => {})
db.schema.createTableIfNotExists('files', function (table) {
@@ -16,13 +16,13 @@ let init = function(db, config){
table.string('size')
table.string('ip')
table.integer('albumid')
- table.timestamps()
+ table.integer('timestamp')
}).then(() => {})
db.schema.createTableIfNotExists('tokens', function (table) {
table.string('name')
table.string('value')
- table.timestamps()
+ table.integer('timestamp')
}).then(() => {
// == Generate a 1 time token == //
@@ -32,16 +32,19 @@ let init = function(db, config){
// This is the first launch of the app
let clientToken = require('randomstring').generate()
let adminToken = require('randomstring').generate()
+ let now = Math.floor(Date.now() / 1000)
db.table('tokens').insert(
[
{
name: 'client',
- value: clientToken
+ value: clientToken,
+ timestamp: now
},
{
name: 'admin',
- value: adminToken
+ value: adminToken,
+ timestamp: now
}
]
).then(() => {