summary refs log tree commit diff
path: root/src/util/migration/postgres
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-09-23 21:05:35 +0200
committerRory& <root@rory.gay>2025-09-29 18:38:06 +0200
commit1e6ed06da142e4aa558cf1ada38204d4adf55c92 (patch)
tree7aaa3c5aa9e3af232e3905012a3722a66f23b522 /src/util/migration/postgres
parentFix schema for preload messages (diff)
downloadserver-ts-1e6ed06da142e4aa558cf1ada38204d4adf55c92.tar.xz
Add first half of cloud attachment uploads
Diffstat (limited to 'src/util/migration/postgres')
-rw-r--r--src/util/migration/postgres/1758654246197-CloudAttachments.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/util/migration/postgres/1758654246197-CloudAttachments.ts b/src/util/migration/postgres/1758654246197-CloudAttachments.ts
new file mode 100644

index 000000000..03f745b2b --- /dev/null +++ b/src/util/migration/postgres/1758654246197-CloudAttachments.ts
@@ -0,0 +1,18 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class CloudAttachments1758654246197 implements MigrationInterface { + name = 'CloudAttachments1758654246197' + + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`CREATE TABLE "cloud_attachments" ("id" character varying NOT NULL, "user_id" character varying, "channel_id" character varying, "upload_filename" character varying NOT NULL, "user_attachment_id" character varying, "user_filename" character varying NOT NULL, "user_file_size" integer, "user_original_content_type" character varying, "user_is_clip" boolean, "size" integer, "height" integer, "width" integer, "content_type" character varying, "userId" character varying, "channelId" character varying, CONSTRAINT "PK_5794827a3ee7c9318612dcb70c8" PRIMARY KEY ("id"))`); + await queryRunner.query(`ALTER TABLE "cloud_attachments" ADD CONSTRAINT "FK_e6b32df2004e8ad0f488b4a2019" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE "cloud_attachments" ADD CONSTRAINT "FK_cab965a18f8ca30293bff3d50a8" FOREIGN KEY ("channelId") REFERENCES "channels"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); + } + + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE "cloud_attachments" DROP CONSTRAINT "FK_cab965a18f8ca30293bff3d50a8"`); + await queryRunner.query(`ALTER TABLE "cloud_attachments" DROP CONSTRAINT "FK_e6b32df2004e8ad0f488b4a2019"`); + await queryRunner.query(`DROP TABLE "cloud_attachments"`); + } + +}