aboutsummaryrefslogtreecommitdiff
path: root/src/api/database/migrations/20190221225812_initialMigration.js
diff options
context:
space:
mode:
authorPitu <[email protected]>2020-12-27 03:02:14 +0900
committerPitu <[email protected]>2020-12-27 03:02:14 +0900
commit68634418e1c86d5ebd5dc2feead241919d3aa9ed (patch)
treebd07175599458add579dee83934f49bbdf2cda21 /src/api/database/migrations/20190221225812_initialMigration.js
parentchore: use instance name for album download (diff)
downloadhost.fuwn.me-68634418e1c86d5ebd5dc2feead241919d3aa9ed.tar.xz
host.fuwn.me-68634418e1c86d5ebd5dc2feead241919d3aa9ed.zip
Squashed commit of the following:
commit df4b0378571708086a276e49ac8630095e08b0b7 Author: Pitu <[email protected]> Date: Sun Dec 27 03:00:17 2020 +0900 feat: move database modification to a new migration file
Diffstat (limited to 'src/api/database/migrations/20190221225812_initialMigration.js')
-rw-r--r--src/api/database/migrations/20190221225812_initialMigration.js18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/api/database/migrations/20190221225812_initialMigration.js b/src/api/database/migrations/20190221225812_initialMigration.js
index 92103c1..a27a08a 100644
--- a/src/api/database/migrations/20190221225812_initialMigration.js
+++ b/src/api/database/migrations/20190221225812_initialMigration.js
@@ -1,11 +1,11 @@
exports.up = async knex => {
await knex.schema.createTable('users', table => {
table.increments();
- table.string('username').unique();
+ table.string('username');
table.text('password');
table.boolean('enabled');
table.boolean('isAdmin');
- table.string('apiKey').unique();
+ table.string('apiKey');
table.timestamp('passwordEditedAt');
table.timestamp('apiKeyEditedAt');
table.timestamp('createdAt');
@@ -16,12 +16,9 @@ exports.up = async knex => {
table.increments();
table.integer('userId');
table.string('name');
- table.boolean('nsfw').defaultTo(false);
table.timestamp('zippedAt');
table.timestamp('createdAt');
table.timestamp('editedAt');
-
- table.unique(['userId', 'name']);
});
await knex.schema.createTable('files', table => {
@@ -31,7 +28,6 @@ exports.up = async knex => {
table.string('original');
table.string('type');
table.integer('size');
- table.boolean('nsfw').defaultTo(false);
table.string('hash');
table.string('ip');
table.timestamp('createdAt');
@@ -49,22 +45,18 @@ exports.up = async knex => {
table.timestamp('expiresAt');
table.timestamp('createdAt');
table.timestamp('editedAt');
-
- table.unique(['userId', 'albumId', 'identifier']);
});
await knex.schema.createTable('albumsFiles', table => {
table.increments();
table.integer('albumId');
table.integer('fileId');
-
- table.unique(['albumId', 'fileId']);
});
await knex.schema.createTable('albumsLinks', table => {
table.increments();
table.integer('albumId');
- table.integer('linkId').unique();
+ table.integer('linkId');
});
await knex.schema.createTable('tags', table => {
@@ -74,16 +66,12 @@ exports.up = async knex => {
table.string('name');
table.timestamp('createdAt');
table.timestamp('editedAt');
-
- table.unique(['userId', 'name']);
});
await knex.schema.createTable('fileTags', table => {
table.increments();
table.integer('fileId');
table.integer('tagId');
-
- table.unique(['fileId', 'tagId']);
});
await knex.schema.createTable('bans', table => {