aboutsummaryrefslogtreecommitdiff
path: root/src/api/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/database')
-rw-r--r--src/api/database/migrations/20190221225812_initialMigration.js4
-rw-r--r--src/api/database/seeds/initial.js2
2 files changed, 2 insertions, 4 deletions
diff --git a/src/api/database/migrations/20190221225812_initialMigration.js b/src/api/database/migrations/20190221225812_initialMigration.js
index 84bda7e..a27a08a 100644
--- a/src/api/database/migrations/20190221225812_initialMigration.js
+++ b/src/api/database/migrations/20190221225812_initialMigration.js
@@ -1,7 +1,6 @@
exports.up = async knex => {
await knex.schema.createTable('users', table => {
table.increments();
- table.string('uuid');
table.string('username');
table.text('password');
table.boolean('enabled');
@@ -15,7 +14,6 @@ exports.up = async knex => {
await knex.schema.createTable('albums', table => {
table.increments();
- table.string('uuid');
table.integer('userId');
table.string('name');
table.timestamp('zippedAt');
@@ -25,7 +23,6 @@ exports.up = async knex => {
await knex.schema.createTable('files', table => {
table.increments();
- table.string('uuid');
table.integer('userId');
table.string('name');
table.string('original');
@@ -39,7 +36,6 @@ exports.up = async knex => {
await knex.schema.createTable('links', table => {
table.increments();
- table.string('uuid');
table.integer('userId');
table.integer('albumId');
table.string('identifier');
diff --git a/src/api/database/seeds/initial.js b/src/api/database/seeds/initial.js
index 280fd74..5e906fb 100644
--- a/src/api/database/seeds/initial.js
+++ b/src/api/database/seeds/initial.js
@@ -1,5 +1,6 @@
const bcrypt = require('bcrypt');
const moment = require('moment');
+const uuidv4 = require('uuid/v4');
exports.seed = async db => {
const now = moment.utc().toDate();
@@ -8,6 +9,7 @@ exports.seed = async db => {
try {
const hash = await bcrypt.hash(process.env.ADMIN_PASSWORD, 10);
await db.table('users').insert({
+ uuid: uuidv4(),
username: process.env.ADMIN_ACCOUNT,
password: hash,
passwordEditedAt: now,