LocChat/server/database/migrations/1637028716848-AddUser.ts

45 lines
1.0 KiB
TypeScript
Raw Normal View History

2021-11-16 21:14:46 -05:00
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
export class AddUser1637028716848 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: 'user',
columns: [
{
name: 'id',
type: 'int',
isPrimary: true,
2021-11-20 20:18:58 -05:00
isGenerated: true,
2021-11-16 21:14:46 -05:00
},
{
2021-12-03 20:31:24 -05:00
name: 'firstName',
type: 'text',
isNullable: false,
},
{
name: 'lastName',
2021-11-16 21:14:46 -05:00
type: 'text',
isNullable: false,
},
{
2021-11-23 16:04:12 -05:00
name: 'passwordHash',
2021-11-16 21:14:46 -05:00
type: 'text',
isNullable: false,
},
{
name: 'email',
type: 'text',
isNullable: false,
2021-11-20 20:18:58 -05:00
isUnique: true,
2021-11-16 21:14:46 -05:00
},
],
}),
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable('user');
}
}