Files
server/util/PostgresMigrations/Migrations/20260407135037_CreateOrganizationInviteLink.cs
Rui Tomé e10b13f0eb [PM-34178] Add entities, repository and database migrations for Organization Invite Link feature (#7407)
* Add feature flag for Organization Invite Links

* Add OrganizationInviteLink database entity

* Add OrganizationInviteLink table sql script and also OrganizationInviteLinkView that reads from it

* Add OrganizationInviteLink stored procedures for CRUD operations

* Add SQL migration script

* Add EF migrations

* Add EF configurations

* Add IOrganizationInviteLinkRepository and integration tests

* Add OrganizationInviteLinkRepository Dapper implementation

* refactor(tests): Update OrganizationInviteLinkRepositoryTests to use [Theory] attribute for test cases
2026-04-09 15:22:38 +01:00

57 lines
2.1 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
/// <inheritdoc />
public partial class CreateOrganizationInviteLink : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "OrganizationInviteLink",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Code = table.Column<Guid>(type: "uuid", nullable: false),
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
AllowedDomains = table.Column<string>(type: "text", nullable: false),
EncryptedInviteKey = table.Column<string>(type: "text", nullable: false),
EncryptedOrgKey = table.Column<string>(type: "text", nullable: true),
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
RevisionDate = table.Column<DateTime>(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);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "OrganizationInviteLink");
}
}