LocChat/server/database/migrations/1648605030863-AddChatRoom.ts

44 lines
1023 B
TypeScript
Raw Normal View History

2022-03-29 22:17:08 -04:00
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
export class AddChatRoom1648605030863 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: 'chatroom',
columns: [
{
name: 'id',
type: 'int',
isPrimary: true,
isGenerated: true,
},
{
name: 'name',
type: 'text',
isNullable: false,
},
{
name: 'latitude',
type: 'float',
isNullable: false,
},
{
name: 'longitude',
type: 'float',
isNullable: false,
},
{
name: 'radius',
type: 'float',
isNullable: false,
},
],
}),
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable('chatroom');
}
}