From 65a1b5d08d8f2b418c170b3751efdc5e349b80b0 Mon Sep 17 00:00:00 2001 From: jaasen-livefront Date: Fri, 14 Nov 2025 11:19:49 -0800 Subject: [PATCH] fix pg migration --- .../20251114184851_AddCipherArchive.cs | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/util/PostgresMigrations/Migrations/20251114184851_AddCipherArchive.cs b/util/PostgresMigrations/Migrations/20251114184851_AddCipherArchive.cs index ccb650e58e..70da3d9bea 100644 --- a/util/PostgresMigrations/Migrations/20251114184851_AddCipherArchive.cs +++ b/util/PostgresMigrations/Migrations/20251114184851_AddCipherArchive.cs @@ -4,18 +4,46 @@ namespace Bit.PostgresMigrations.Migrations; -/// public partial class AddCipherArchive : Migration { - /// protected override void Up(MigrationBuilder migrationBuilder) { + migrationBuilder.CreateTable( + name: "CipherArchive", + columns: table => new + { + CipherId = table.Column(type: "uuid", nullable: false), + UserId = table.Column(type: "uuid", nullable: false), + ArchivedDate = table.Column( + type: "timestamp with time zone", + nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CipherArchive", x => new { x.CipherId, x.UserId }); + table.ForeignKey( + name: "FK_CipherArchive_Cipher_CipherId", + column: x => x.CipherId, + principalTable: "Cipher", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CipherArchive_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateIndex( + name: "IX_CipherArchive_UserId", + table: "CipherArchive", + column: "UserId"); } - /// protected override void Down(MigrationBuilder migrationBuilder) { - + migrationBuilder.DropTable( + name: "CipherArchive"); } }