1
0
mirror of https://github.com/bitwarden/server synced 2025-12-10 05:13:48 +00:00

recreate ef migrations

This commit is contained in:
Matt Gibson
2025-11-17 17:19:53 -08:00
parent 1ebfac18a2
commit d6eaafb308
13 changed files with 233 additions and 300 deletions

View File

@@ -40,7 +40,7 @@ public class PlayDataEntityTypeConfiguration : IEntityTypeConfiguration<PlayData
.ToTable(nameof(PlayData))
.HasCheckConstraint(
"CK_PlayData_UserOrOrganization",
"([UserId] IS NOT NULL AND [OrganizationId] IS NULL) OR ([UserId] IS NULL AND [OrganizationId] IS NOT NULL)"
"(\"UserId\" IS NOT NULL AND \"OrganizationId\" IS NULL) OR (\"UserId\" IS NULL AND \"OrganizationId\" IS NOT NULL)"
);
}
}

View File

@@ -1,98 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.MySqlMigrations.Migrations;
/// <inheritdoc />
public partial class PlayData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "Id",
table: "PlayData",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci");
migrationBuilder.AddColumn<DateTime>(
name: "CreationDate",
table: "PlayData",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "PlayId",
table: "PlayData",
type: "varchar(256)",
maxLength: 256,
nullable: false,
defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddPrimaryKey(
name: "PK_PlayData",
table: "PlayData",
column: "Id");
migrationBuilder.CreateIndex(
name: "IX_PlayData_OrganizationId",
table: "PlayData",
column: "OrganizationId");
migrationBuilder.CreateIndex(
name: "IX_PlayData_PlayId",
table: "PlayData",
column: "PlayId");
migrationBuilder.CreateIndex(
name: "IX_PlayData_UserId",
table: "PlayData",
column: "UserId");
migrationBuilder.AddCheckConstraint(
name: "CK_PlayData_UserOrOrganization",
table: "PlayData",
sql: "([UserId] IS NOT NULL AND [OrganizationId] IS NULL) OR ([UserId] IS NULL AND [OrganizationId] IS NOT NULL)");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_PlayData",
table: "PlayData");
migrationBuilder.DropIndex(
name: "IX_PlayData_OrganizationId",
table: "PlayData");
migrationBuilder.DropIndex(
name: "IX_PlayData_PlayId",
table: "PlayData");
migrationBuilder.DropIndex(
name: "IX_PlayData_UserId",
table: "PlayData");
migrationBuilder.DropCheckConstraint(
name: "CK_PlayData_UserOrOrganization",
table: "PlayData");
migrationBuilder.DropColumn(
name: "Id",
table: "PlayData");
migrationBuilder.DropColumn(
name: "CreationDate",
table: "PlayData");
migrationBuilder.DropColumn(
name: "PlayId",
table: "PlayData");
}
}

View File

@@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Bit.MySqlMigrations.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20251117210114_PlayData")]
[Migration("20251118024031_PlayData")]
partial class PlayData
{
/// <inheritdoc />
@@ -1656,7 +1656,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("PlayData", null, t =>
{
t.HasCheckConstraint("CK_PlayData_UserOrOrganization", "([UserId] IS NOT NULL AND [OrganizationId] IS NULL) OR ([UserId] IS NULL AND [OrganizationId] IS NOT NULL)");
t.HasCheckConstraint("CK_PlayData_UserOrOrganization", "(\"UserId\" IS NOT NULL AND \"OrganizationId\" IS NULL) OR (\"UserId\" IS NULL AND \"OrganizationId\" IS NOT NULL)");
});
});

View File

@@ -0,0 +1,81 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.MySqlMigrations.Migrations;
/// <inheritdoc />
public partial class PlayData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<short>(
name: "WaitTimeDays",
table: "EmergencyAccess",
type: "smallint",
nullable: false,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.CreateTable(
name: "PlayData",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
PlayId = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
UserId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
OrganizationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PlayData", x => x.Id);
table.CheckConstraint("CK_PlayData_UserOrOrganization", "(\"UserId\" IS NOT NULL AND \"OrganizationId\" IS NULL) OR (\"UserId\" IS NULL AND \"OrganizationId\" IS NOT NULL)");
table.ForeignKey(
name: "FK_PlayData_Organization_OrganizationId",
column: x => x.OrganizationId,
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PlayData_User_UserId",
column: x => x.UserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_PlayData_OrganizationId",
table: "PlayData",
column: "OrganizationId");
migrationBuilder.CreateIndex(
name: "IX_PlayData_PlayId",
table: "PlayData",
column: "PlayId");
migrationBuilder.CreateIndex(
name: "IX_PlayData_UserId",
table: "PlayData",
column: "UserId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PlayData");
migrationBuilder.AlterColumn<int>(
name: "WaitTimeDays",
table: "EmergencyAccess",
type: "int",
nullable: false,
oldClrType: typeof(short),
oldType: "smallint");
}
}

View File

@@ -1653,7 +1653,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("PlayData", null, t =>
{
t.HasCheckConstraint("CK_PlayData_UserOrOrganization", "([UserId] IS NOT NULL AND [OrganizationId] IS NULL) OR ([UserId] IS NULL AND [OrganizationId] IS NOT NULL)");
t.HasCheckConstraint("CK_PlayData_UserOrOrganization", "(\"UserId\" IS NOT NULL AND \"OrganizationId\" IS NULL) OR (\"UserId\" IS NULL AND \"OrganizationId\" IS NOT NULL)");
});
});

View File

@@ -1,96 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
/// <inheritdoc />
public partial class PlayData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "Id",
table: "PlayData",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<DateTime>(
name: "CreationDate",
table: "PlayData",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "PlayId",
table: "PlayData",
type: "character varying(256)",
maxLength: 256,
nullable: false,
defaultValue: "");
migrationBuilder.AddPrimaryKey(
name: "PK_PlayData",
table: "PlayData",
column: "Id");
migrationBuilder.CreateIndex(
name: "IX_PlayData_OrganizationId",
table: "PlayData",
column: "OrganizationId");
migrationBuilder.CreateIndex(
name: "IX_PlayData_PlayId",
table: "PlayData",
column: "PlayId");
migrationBuilder.CreateIndex(
name: "IX_PlayData_UserId",
table: "PlayData",
column: "UserId");
migrationBuilder.AddCheckConstraint(
name: "CK_PlayData_UserOrOrganization",
table: "PlayData",
sql: "([UserId] IS NOT NULL AND [OrganizationId] IS NULL) OR ([UserId] IS NULL AND [OrganizationId] IS NOT NULL)");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_PlayData",
table: "PlayData");
migrationBuilder.DropIndex(
name: "IX_PlayData_OrganizationId",
table: "PlayData");
migrationBuilder.DropIndex(
name: "IX_PlayData_PlayId",
table: "PlayData");
migrationBuilder.DropIndex(
name: "IX_PlayData_UserId",
table: "PlayData");
migrationBuilder.DropCheckConstraint(
name: "CK_PlayData_UserOrOrganization",
table: "PlayData");
migrationBuilder.DropColumn(
name: "Id",
table: "PlayData");
migrationBuilder.DropColumn(
name: "CreationDate",
table: "PlayData");
migrationBuilder.DropColumn(
name: "PlayId",
table: "PlayData");
}
}

View File

@@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Bit.PostgresMigrations.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20251117210121_PlayData")]
[Migration("20251118024041_PlayData")]
partial class PlayData
{
/// <inheritdoc />
@@ -1661,7 +1661,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("PlayData", null, t =>
{
t.HasCheckConstraint("CK_PlayData_UserOrOrganization", "([UserId] IS NOT NULL AND [OrganizationId] IS NULL) OR ([UserId] IS NULL AND [OrganizationId] IS NOT NULL)");
t.HasCheckConstraint("CK_PlayData_UserOrOrganization", "(\"UserId\" IS NOT NULL AND \"OrganizationId\" IS NULL) OR (\"UserId\" IS NULL AND \"OrganizationId\" IS NOT NULL)");
});
});

View File

@@ -0,0 +1,79 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
/// <inheritdoc />
public partial class PlayData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<short>(
name: "WaitTimeDays",
table: "EmergencyAccess",
type: "smallint",
nullable: false,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.CreateTable(
name: "PlayData",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
PlayId = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
UserId = table.Column<Guid>(type: "uuid", nullable: true),
OrganizationId = table.Column<Guid>(type: "uuid", nullable: true),
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PlayData", x => x.Id);
table.CheckConstraint("CK_PlayData_UserOrOrganization", "(\"UserId\" IS NOT NULL AND \"OrganizationId\" IS NULL) OR (\"UserId\" IS NULL AND \"OrganizationId\" IS NOT NULL)");
table.ForeignKey(
name: "FK_PlayData_Organization_OrganizationId",
column: x => x.OrganizationId,
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PlayData_User_UserId",
column: x => x.UserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_PlayData_OrganizationId",
table: "PlayData",
column: "OrganizationId");
migrationBuilder.CreateIndex(
name: "IX_PlayData_PlayId",
table: "PlayData",
column: "PlayId");
migrationBuilder.CreateIndex(
name: "IX_PlayData_UserId",
table: "PlayData",
column: "UserId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PlayData");
migrationBuilder.AlterColumn<int>(
name: "WaitTimeDays",
table: "EmergencyAccess",
type: "integer",
nullable: false,
oldClrType: typeof(short),
oldType: "smallint");
}
}

View File

@@ -1658,7 +1658,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("PlayData", null, t =>
{
t.HasCheckConstraint("CK_PlayData_UserOrOrganization", "([UserId] IS NOT NULL AND [OrganizationId] IS NULL) OR ([UserId] IS NULL AND [OrganizationId] IS NOT NULL)");
t.HasCheckConstraint("CK_PlayData_UserOrOrganization", "(\"UserId\" IS NOT NULL AND \"OrganizationId\" IS NULL) OR (\"UserId\" IS NULL AND \"OrganizationId\" IS NOT NULL)");
});
});

View File

@@ -1,96 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.SqliteMigrations.Migrations;
/// <inheritdoc />
public partial class PlayData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "Id",
table: "PlayData",
type: "TEXT",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.AddColumn<DateTime>(
name: "CreationDate",
table: "PlayData",
type: "TEXT",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "PlayId",
table: "PlayData",
type: "TEXT",
maxLength: 256,
nullable: false,
defaultValue: "");
migrationBuilder.AddPrimaryKey(
name: "PK_PlayData",
table: "PlayData",
column: "Id");
migrationBuilder.CreateIndex(
name: "IX_PlayData_OrganizationId",
table: "PlayData",
column: "OrganizationId");
migrationBuilder.CreateIndex(
name: "IX_PlayData_PlayId",
table: "PlayData",
column: "PlayId");
migrationBuilder.CreateIndex(
name: "IX_PlayData_UserId",
table: "PlayData",
column: "UserId");
migrationBuilder.AddCheckConstraint(
name: "CK_PlayData_UserOrOrganization",
table: "PlayData",
sql: "([UserId] IS NOT NULL AND [OrganizationId] IS NULL) OR ([UserId] IS NULL AND [OrganizationId] IS NOT NULL)");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_PlayData",
table: "PlayData");
migrationBuilder.DropIndex(
name: "IX_PlayData_OrganizationId",
table: "PlayData");
migrationBuilder.DropIndex(
name: "IX_PlayData_PlayId",
table: "PlayData");
migrationBuilder.DropIndex(
name: "IX_PlayData_UserId",
table: "PlayData");
migrationBuilder.DropCheckConstraint(
name: "CK_PlayData_UserOrOrganization",
table: "PlayData");
migrationBuilder.DropColumn(
name: "Id",
table: "PlayData");
migrationBuilder.DropColumn(
name: "CreationDate",
table: "PlayData");
migrationBuilder.DropColumn(
name: "PlayId",
table: "PlayData");
}
}

View File

@@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Bit.SqliteMigrations.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20251117210127_PlayData")]
[Migration("20251118024036_PlayData")]
partial class PlayData
{
/// <inheritdoc />
@@ -1645,7 +1645,7 @@ namespace Bit.SqliteMigrations.Migrations
b.ToTable("PlayData", null, t =>
{
t.HasCheckConstraint("CK_PlayData_UserOrOrganization", "([UserId] IS NOT NULL AND [OrganizationId] IS NULL) OR ([UserId] IS NULL AND [OrganizationId] IS NOT NULL)");
t.HasCheckConstraint("CK_PlayData_UserOrOrganization", "(\"UserId\" IS NOT NULL AND \"OrganizationId\" IS NULL) OR (\"UserId\" IS NULL AND \"OrganizationId\" IS NOT NULL)");
});
});

View File

@@ -0,0 +1,63 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.SqliteMigrations.Migrations;
/// <inheritdoc />
public partial class PlayData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PlayData",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
PlayId = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
UserId = table.Column<Guid>(type: "TEXT", nullable: true),
OrganizationId = table.Column<Guid>(type: "TEXT", nullable: true),
CreationDate = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PlayData", x => x.Id);
table.CheckConstraint("CK_PlayData_UserOrOrganization", "(\"UserId\" IS NOT NULL AND \"OrganizationId\" IS NULL) OR (\"UserId\" IS NULL AND \"OrganizationId\" IS NOT NULL)");
table.ForeignKey(
name: "FK_PlayData_Organization_OrganizationId",
column: x => x.OrganizationId,
principalTable: "Organization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PlayData_User_UserId",
column: x => x.UserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_PlayData_OrganizationId",
table: "PlayData",
column: "OrganizationId");
migrationBuilder.CreateIndex(
name: "IX_PlayData_PlayId",
table: "PlayData",
column: "PlayId");
migrationBuilder.CreateIndex(
name: "IX_PlayData_UserId",
table: "PlayData",
column: "UserId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PlayData");
}
}

View File

@@ -1642,7 +1642,7 @@ namespace Bit.SqliteMigrations.Migrations
b.ToTable("PlayData", null, t =>
{
t.HasCheckConstraint("CK_PlayData_UserOrOrganization", "([UserId] IS NOT NULL AND [OrganizationId] IS NULL) OR ([UserId] IS NULL AND [OrganizationId] IS NOT NULL)");
t.HasCheckConstraint("CK_PlayData_UserOrOrganization", "(\"UserId\" IS NOT NULL AND \"OrganizationId\" IS NULL) OR (\"UserId\" IS NULL AND \"OrganizationId\" IS NOT NULL)");
});
});