using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
///
public partial class CreateOrganizationInviteLink : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "OrganizationInviteLink",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
Code = table.Column(type: "uuid", nullable: false),
OrganizationId = table.Column(type: "uuid", nullable: false),
AllowedDomains = table.Column(type: "text", nullable: false),
EncryptedInviteKey = table.Column(type: "text", nullable: false),
EncryptedOrgKey = table.Column(type: "text", nullable: true),
CreationDate = table.Column(type: "timestamp with time zone", nullable: false),
RevisionDate = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrganizationInviteLink", x => x.Id);
table.ForeignKey(
name: "FK_OrganizationInviteLink_Organization_OrganizationId",
column: x => x.OrganizationId,
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_OrganizationInviteLink_Code",
table: "OrganizationInviteLink",
column: "Code",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_OrganizationInviteLink_OrganizationId",
table: "OrganizationInviteLink",
column: "OrganizationId",
unique: true);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "OrganizationInviteLink");
}
}