summary refs log tree commit diff
path: root/src/util/migration/postgres
diff options
context:
space:
mode:
authordank074 <torresefrain10@gmail.com>2025-06-21 21:41:13 -0500
committerGitHub <noreply@github.com>2025-06-22 12:41:13 +1000
commit526a8da8f509c7320b9b8bc3084fb4d53e88aaf1 (patch)
treeca16b079aa3ced092cf5f06a27f1100e5f556721 /src/util/migration/postgres
parentsend the real index (diff)
downloadserver-ts-526a8da8f509c7320b9b8bc3084fb4d53e88aaf1.tar.xz
add webrtc support (#1284)
Co-authored-by: MaddyUnderStars <46743919+MaddyUnderStars@users.noreply.github.com>
Diffstat (limited to 'src/util/migration/postgres')
-rw-r--r--src/util/migration/postgres/1745625724865-voice.ts43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/util/migration/postgres/1745625724865-voice.ts b/src/util/migration/postgres/1745625724865-voice.ts
new file mode 100644

index 000000000..d9f7101f5 --- /dev/null +++ b/src/util/migration/postgres/1745625724865-voice.ts
@@ -0,0 +1,43 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class Voice1745625724865 implements MigrationInterface { + name = "Voice1745625724865"; + + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query( + `CREATE TABLE "streams" ("id" character varying NOT NULL, "owner_id" character varying NOT NULL, "channel_id" character varying NOT NULL, "endpoint" character varying NOT NULL, CONSTRAINT "PK_40440b6f569ebc02bc71c25c499" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TABLE "stream_sessions" ("id" character varying NOT NULL, "stream_id" character varying NOT NULL, "user_id" character varying NOT NULL, "token" character varying, "session_id" character varying NOT NULL, "used" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_49bdc3f66394c12478f8371c546" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `ALTER TABLE "streams" ADD CONSTRAINT "FK_1b566f9b54d1cda271da53ac82f" FOREIGN KEY ("owner_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "streams" ADD CONSTRAINT "FK_5101f0cded27ff0aae78fc4eed7" FOREIGN KEY ("channel_id") REFERENCES "channels"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "stream_sessions" ADD CONSTRAINT "FK_8b5a028a34dae9ee54af37c9c32" FOREIGN KEY ("stream_id") REFERENCES "streams"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "stream_sessions" ADD CONSTRAINT "FK_13ae5c29aff4d0890c54179511a" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query( + `ALTER TABLE "stream_sessions" DROP CONSTRAINT "FK_13ae5c29aff4d0890c54179511a"`, + ); + await queryRunner.query( + `ALTER TABLE "stream_sessions" DROP CONSTRAINT "FK_8b5a028a34dae9ee54af37c9c32"`, + ); + await queryRunner.query( + `ALTER TABLE "streams" DROP CONSTRAINT "FK_5101f0cded27ff0aae78fc4eed7"`, + ); + await queryRunner.query( + `ALTER TABLE "streams" DROP CONSTRAINT "FK_1b566f9b54d1cda271da53ac82f"`, + ); + await queryRunner.query(`DROP TABLE "stream_sessions"`); + await queryRunner.query(`DROP TABLE "streams"`); + } +}