aboutsummaryrefslogtreecommitdiff
path: root/src/api/database
diff options
context:
space:
mode:
authorPitu <[email protected]>2019-10-13 02:53:45 +0900
committerPitu <[email protected]>2019-10-13 02:53:45 +0900
commitcba7bf8586f59a049f79aba586db201ac6f3530b (patch)
tree46aeabe2b5463456ef3eb241a38407a5699e3728 /src/api/database
parentdon't log out on API error (diff)
downloadhost.fuwn.me-cba7bf8586f59a049f79aba586db201ac6f3530b.tar.xz
host.fuwn.me-cba7bf8586f59a049f79aba586db201ac6f3530b.zip
This commit adds a bunch of features for admins:
* banning IP * see files from other users if you are admin * be able to see details of an uploaded file and it's user * improved display of thumbnails for non-image files
Diffstat (limited to 'src/api/database')
-rw-r--r--src/api/database/migrations/20190221225812_initialMigration.js24
-rw-r--r--src/api/database/migrations/20190221225813_addTags.js21
2 files changed, 24 insertions, 21 deletions
diff --git a/src/api/database/migrations/20190221225812_initialMigration.js b/src/api/database/migrations/20190221225812_initialMigration.js
index a9ce2c7..84bda7e 100644
--- a/src/api/database/migrations/20190221225812_initialMigration.js
+++ b/src/api/database/migrations/20190221225812_initialMigration.js
@@ -62,6 +62,27 @@ exports.up = async knex => {
table.integer('albumId');
table.integer('linkId');
});
+
+ await knex.schema.createTable('tags', table => {
+ table.increments();
+ table.string('uuid');
+ table.integer('userId');
+ table.string('name');
+ table.timestamp('createdAt');
+ table.timestamp('editedAt');
+ });
+
+ await knex.schema.createTable('fileTags', table => {
+ table.increments();
+ table.integer('fileId');
+ table.integer('tagId');
+ });
+
+ await knex.schema.createTable('bans', table => {
+ table.increments();
+ table.string('ip');
+ table.timestamp('createdAt');
+ });
};
exports.down = async knex => {
await knex.schema.dropTableIfExists('users');
@@ -70,4 +91,7 @@ exports.down = async knex => {
await knex.schema.dropTableIfExists('links');
await knex.schema.dropTableIfExists('albumsFiles');
await knex.schema.dropTableIfExists('albumsLinks');
+ await knex.schema.dropTableIfExists('tags');
+ await knex.schema.dropTableIfExists('fileTags');
+ await knex.schema.dropTableIfExists('bans');
};
diff --git a/src/api/database/migrations/20190221225813_addTags.js b/src/api/database/migrations/20190221225813_addTags.js
deleted file mode 100644
index ef71877..0000000
--- a/src/api/database/migrations/20190221225813_addTags.js
+++ /dev/null
@@ -1,21 +0,0 @@
-exports.up = async knex => {
- await knex.schema.createTable('tags', table => {
- table.increments();
- table.string('uuid');
- table.integer('userId');
- table.string('name');
- table.timestamp('createdAt');
- table.timestamp('editedAt');
- });
-
- await knex.schema.createTable('fileTags', table => {
- table.increments();
- table.integer('fileId');
- table.integer('tagId');
- });
-};
-
-exports.down = async knex => {
- await knex.schema.dropTableIfExists('tags');
- await knex.schema.dropTableIfExists('fileTags');
-};