feat(F-083): completed feature
This commit is contained in:
20
project/migrations/032_password_reset_tokens.js
Normal file
20
project/migrations/032_password_reset_tokens.js
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
exports.up = async (pgm) => {
|
||||
pgm.createTable('identity_password_reset_tokens', {
|
||||
id: { type: 'uuid', primaryKey: true, default: pgm.func('gen_random_uuid()') },
|
||||
user_id: { type: 'uuid', notNull: true, references: 'identity_users(id)', onDelete: 'CASCADE' },
|
||||
token_hash: { type: 'text', notNull: true, unique: true },
|
||||
expires_at: { type: 'timestamptz', notNull: true },
|
||||
used_at: { type: 'timestamptz' },
|
||||
request_ip: { type: 'text' },
|
||||
request_user_agent: { type: 'text' },
|
||||
created_at: { type: 'timestamptz', notNull: true, default: pgm.func('now()') },
|
||||
});
|
||||
pgm.createIndex('identity_password_reset_tokens', 'user_id');
|
||||
pgm.createIndex('identity_password_reset_tokens', 'expires_at');
|
||||
};
|
||||
|
||||
exports.down = async (pgm) => {
|
||||
pgm.dropTable('identity_password_reset_tokens');
|
||||
};
|
||||
Reference in New Issue
Block a user