diff options
Diffstat (limited to 'backend/migrations')
| -rw-r--r-- | backend/migrations/20200201152838_initial.js | 12 | ||||
| -rw-r--r-- | backend/migrations/20200201153559_tokens.js | 14 |
2 files changed, 26 insertions, 0 deletions
diff --git a/backend/migrations/20200201152838_initial.js b/backend/migrations/20200201152838_initial.js new file mode 100644 index 0000000..3131525 --- /dev/null +++ b/backend/migrations/20200201152838_initial.js @@ -0,0 +1,12 @@ +exports.up = function(knex) { + return knex.schema.createTable('users', function(table) { + table.increments(); + table.string('username').notNullable(); + table.string('password').notNullable(); + table.timestamps(true, true); + }); +}; + +exports.down = function(knex) { + return knex.schema.dropTable('users'); +}; diff --git a/backend/migrations/20200201153559_tokens.js b/backend/migrations/20200201153559_tokens.js new file mode 100644 index 0000000..70593fc --- /dev/null +++ b/backend/migrations/20200201153559_tokens.js @@ -0,0 +1,14 @@ +exports.up = function(knex) { + return knex.schema.createTable('tokens', function(table) { + table.increments(); + table.integer('user_id').unsigned().notNullable(); + table.foreign('user_id').references('users.id'); + table.enu('type', [ 'session' ]).notNullable(); + table.string('value').notNullable(); + table.timestamps(true, true); + }); +}; + +exports.down = function(knex) { + return knex.schema.dropTable('tokens'); +}; |
