-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #913 Co-authored-by: Scott Foster <[email protected]>
- Loading branch information
Showing
7 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm"; | ||
import { GameType } from "@port-of-mars/shared/types" | ||
import { User } from "./User"; | ||
|
||
@Entity() | ||
export class LobbyChatMessage { | ||
@PrimaryGeneratedColumn() | ||
id!: number; | ||
|
||
@Column() | ||
dateCreated!: Date; | ||
|
||
@ManyToOne(type => User) | ||
user!: User; | ||
|
||
@Column() | ||
userId!: number; | ||
|
||
@Column() | ||
message!: string; | ||
|
||
@Column() | ||
roomId!: string; | ||
|
||
@Column() | ||
lobbyType!: GameType; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {MigrationInterface, QueryRunner} from "typeorm"; | ||
|
||
export class AddLobbyChatMessage1699482607231 implements MigrationInterface { | ||
name = 'AddLobbyChatMessage1699482607231' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`CREATE TABLE "lobby_chat_message" ("id" SERIAL NOT NULL, "dateCreated" TIMESTAMP NOT NULL, "userId" integer NOT NULL, "message" character varying NOT NULL, "roomId" character varying NOT NULL, "lobbyType" character varying NOT NULL, CONSTRAINT "PK_4640a139c74b0d188cc5efdda33" PRIMARY KEY ("id"))`); | ||
await queryRunner.query(`ALTER TABLE "lobby_chat_message" ADD CONSTRAINT "FK_96a0bc5d48c597dbd5ea6400feb" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "lobby_chat_message" DROP CONSTRAINT "FK_96a0bc5d48c597dbd5ea6400feb"`); | ||
await queryRunner.query(`DROP TABLE "lobby_chat_message"`); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters