using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DodoSSH.Infrastructure.Migrations
{
///
public partial class AddSshKeyItem : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ssh_key",
schema: "dodo",
columns: table => new
{
id = table.Column(type: "uuid", nullable: false),
vault_id = table.Column(type: "uuid", nullable: false),
payload = table.Column(type: "bytea", nullable: false),
data_key_wrap = table.Column(type: "bytea", nullable: true),
content_key_id = table.Column(type: "uuid", nullable: true),
key_generation = table.Column(type: "integer", nullable: false),
payload_aad_version = table.Column(type: "smallint", nullable: false),
public_key_fingerprint = table.Column(type: "character varying(128)", maxLength: 128, nullable: true),
version = table.Column(type: "integer", nullable: false),
change_sequence = table.Column(type: "bigint", nullable: false),
created_at_utc = table.Column(type: "timestamp with time zone", nullable: false),
updated_at_utc = table.Column(type: "timestamp with time zone", nullable: false),
deleted_at_utc = table.Column(type: "timestamp with time zone", nullable: true),
created_by_user_id = table.Column(type: "uuid", nullable: false),
updated_by_user_id = table.Column(type: "uuid", nullable: false),
xmin = table.Column(type: "xid", rowVersion: true, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_ssh_key", x => x.id);
table.CheckConstraint("ck_ssh_key_version", "version >= 1");
table.ForeignKey(
name: "fk_ssh_key_vaults_vault_id",
column: x => x.vault_id,
principalSchema: "dodo",
principalTable: "vault",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_ssh_key_vault_id_change_sequence",
schema: "dodo",
table: "ssh_key",
columns: new[] { "vault_id", "change_sequence" });
migrationBuilder.CreateIndex(
name: "ix_ssh_key_vault_live",
schema: "dodo",
table: "ssh_key",
column: "vault_id",
filter: "deleted_at_utc IS NULL");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ssh_key",
schema: "dodo");
}
}
}