1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-29 18:07:36 +01:00
bitwarden-server/util/PostgresMigrations/Migrations/20210709092227_RemoveProviderOrganizationProviderUser.cs

75 lines
2.9 KiB
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore.Migrations;
2022-08-29 22:06:55 +02:00
namespace Bit.PostgresMigrations.Migrations;
public partial class RemoveProviderOrganizationProviderUser : Migration
{
2022-08-29 22:06:55 +02:00
protected override void Up(MigrationBuilder migrationBuilder)
{
2022-08-29 22:06:55 +02:00
migrationBuilder.DropTable(
name: "ProviderOrganizationProviderUser");
2022-08-29 22:06:55 +02:00
migrationBuilder.AddColumn<Guid>(
name: "ProviderId",
table: "Event",
type: "uuid",
nullable: true);
2022-08-29 22:06:55 +02:00
migrationBuilder.AddColumn<Guid>(
name: "ProviderUserId",
table: "Event",
type: "uuid",
nullable: true);
}
2022-08-29 22:06:55 +02:00
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ProviderId",
table: "Event");
2022-08-29 22:06:55 +02:00
migrationBuilder.DropColumn(
name: "ProviderUserId",
table: "Event");
2022-08-29 22:06:55 +02:00
migrationBuilder.CreateTable(
name: "ProviderOrganizationProviderUser",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
CreationDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Permissions = table.Column<string>(type: "text", nullable: true),
ProviderOrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
ProviderUserId = table.Column<Guid>(type: "uuid", nullable: false),
RevisionDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Type = table.Column<byte>(type: "smallint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProviderOrganizationProviderUser", x => x.Id);
table.ForeignKey(
name: "FK_ProviderOrganizationProviderUser_ProviderOrganization_Provi~",
column: x => x.ProviderOrganizationId,
principalTable: "ProviderOrganization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProviderOrganizationProviderUser_ProviderUser_ProviderUserId",
column: x => x.ProviderUserId,
principalTable: "ProviderUser",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
2022-08-29 22:06:55 +02:00
migrationBuilder.CreateIndex(
name: "IX_ProviderOrganizationProviderUser_ProviderOrganizationId",
table: "ProviderOrganizationProviderUser",
column: "ProviderOrganizationId");
2022-08-29 22:06:55 +02:00
migrationBuilder.CreateIndex(
name: "IX_ProviderOrganizationProviderUser_ProviderUserId",
table: "ProviderOrganizationProviderUser",
column: "ProviderUserId");
}
}