29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import type { Knex } from 'knex';
|
|
|
|
export async function up(knex: Knex): Promise<void> {
|
|
await knex.schema.createTable('users', (t) => {
|
|
t.string('id', 26).primary();
|
|
t.string('email', 255).notNullable().unique();
|
|
t.string('password_hash', 255).notNullable();
|
|
t.string('last_name', 128).nullable();
|
|
t.string('first_name', 128).nullable();
|
|
t.string('middle_name', 128).nullable();
|
|
t.date('birth_date').nullable();
|
|
t.string('crypto_wallet', 255).nullable();
|
|
t.string('phone', 16).nullable();
|
|
t.string('bik', 9).nullable();
|
|
t.string('account_number', 20).nullable();
|
|
t.string('card_number', 19).nullable();
|
|
t.string('inn', 12).nullable();
|
|
t.boolean('kyc_verified').notNullable().defaultTo(false);
|
|
t.timestamp('kyc_verified_at', { useTz: true }).nullable();
|
|
t.boolean('is_deleted').notNullable().defaultTo(false);
|
|
t.timestamp('created_at', { useTz: true }).notNullable().defaultTo(knex.fn.now());
|
|
t.timestamp('updated_at', { useTz: true }).notNullable().defaultTo(knex.fn.now());
|
|
});
|
|
}
|
|
|
|
export async function down(knex: Knex): Promise<void> {
|
|
await knex.schema.dropTableIfExists('users');
|
|
}
|