aboutsummaryrefslogtreecommitdiff
path: root/src/api/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/database')
-rw-r--r--src/api/database/migrations/20190221225813_addTags.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/api/database/migrations/20190221225813_addTags.js b/src/api/database/migrations/20190221225813_addTags.js
new file mode 100644
index 0000000..ef71877
--- /dev/null
+++ b/src/api/database/migrations/20190221225813_addTags.js
@@ -0,0 +1,21 @@
+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');
+};