43 lines
959 B
JavaScript
43 lines
959 B
JavaScript
exports.up = async knex => {
|
|
await knex.schema.createTable('emails', table => {
|
|
table.timestamps(true, true);
|
|
|
|
table.uuid('id')
|
|
.primary()
|
|
.index();
|
|
|
|
table.uuid('account')
|
|
.notNullable()
|
|
.index();
|
|
|
|
table.foreign('account')
|
|
.references('id')
|
|
.inTable('accounts')
|
|
.onDelete('CASCADE');
|
|
|
|
table.string('email', 128)
|
|
.unique()
|
|
.notNullable()
|
|
.index();
|
|
|
|
table.string('confirm_token', 64)
|
|
.notNullable()
|
|
.index();
|
|
|
|
table.string('recover_token', 64)
|
|
.notNullable()
|
|
.index();
|
|
|
|
table.timestamp('recover_token_expiry')
|
|
.notNullable()
|
|
.defaultTo(knex.fn.now());
|
|
|
|
table.bool('confirmed')
|
|
.notNullable()
|
|
.defaultTo(false);
|
|
});
|
|
|
|
return true;
|
|
};
|
|
|
|
exports.down = async () => {}; |