1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-04 14:13:28 +01:00
bitwarden-server/util/MySqlMigrations/Migrations/20210709095522_RemoveProviderOrganizationProviderUser.cs

90 lines
3.5 KiB
C#
Raw Normal View History

using Microsoft.EntityFrameworkCore.Migrations;
2022-08-29 22:06:55 +02:00
namespace Bit.MySqlMigrations.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<bool>(
name: "UseEvents",
table: "Provider",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
2022-08-29 22:06:55 +02:00
migrationBuilder.AddColumn<Guid>(
name: "ProviderId",
table: "Event",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
2022-08-29 22:06:55 +02:00
migrationBuilder.AddColumn<Guid>(
name: "ProviderUserId",
table: "Event",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
}
2022-08-29 22:06:55 +02:00
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UseEvents",
table: "Provider");
2022-08-29 22:06:55 +02:00
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: "char(36)", nullable: false, collation: "ascii_general_ci"),
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
Permissions = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ProviderOrganizationId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ProviderUserId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
RevisionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
Type = table.Column<byte>(type: "tinyint unsigned", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProviderOrganizationProviderUser", x => x.Id);
table.ForeignKey(
name: "FK_ProviderOrganizationProviderUser_ProviderOrganization_Provid~",
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);
})
.Annotation("MySql:CharSet", "utf8mb4");
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");
}
}