LocChat/server/database/migrations/1648605030863-AddChatRoom.ts
2022-03-29 20:17:08 -06:00

44 lines
1023 B
TypeScript

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');
}
}