using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.MySqlMigrations.Migrations;
public partial class AddCipherArchive : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CipherArchive",
columns: table => new
{
CipherId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
UserId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ArchivedDate = table.Column(type: "datetime(6)", 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);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_CipherArchive_UserId",
table: "CipherArchive",
column: "UserId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CipherArchive");
}
}