Added API keys table.
This commit is contained in:
parent
efcbe2b1a1
commit
9e7d46f081
|
@ -0,0 +1,28 @@
|
|||
exports.up = async (knex) => {
|
||||
await knex.schema.createTable('users_keys', (table) => {
|
||||
table.increments('id');
|
||||
|
||||
table.integer('user_id')
|
||||
.notNullable()
|
||||
.references('id')
|
||||
.inTable('users');
|
||||
|
||||
table.text('key')
|
||||
.notNullable();
|
||||
|
||||
table.string('identifier');
|
||||
|
||||
table.unique(['user_id', 'identifier']);
|
||||
|
||||
table.datetime('last_used_at');
|
||||
table.specificType('last_used_ip', 'inet');
|
||||
|
||||
table.datetime('created_at')
|
||||
.notNullable()
|
||||
.defaultTo(knex.fn.now());
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = async (knex) => {
|
||||
await knex.schema.dropTable('users_keys');
|
||||
};
|
Loading…
Reference in New Issue