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

40 lines
927 B
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
},
{
name: 'name',
type: 'text',
isNullable: false,
},
{
name: 'password_hash',
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');
}
}