mirror of
https://github.com/bitwarden/server
synced 2025-12-18 09:13:19 +00:00
fixup seededData vs playData migrations
This commit is contained in:
@@ -1,96 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.PostgresMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class _20251104_00_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.CreateTable(
|
||||
name: "SeededData",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
RecipeName = table.Column<string>(type: "text", nullable: false),
|
||||
Data = table.Column<string>(type: "text", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SeededData", x => x.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");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlayData");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SeededData");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "WaitTimeDays",
|
||||
table: "EmergencyAccess",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
oldClrType: typeof(short),
|
||||
oldType: "smallint");
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace Bit.PostgresMigrations.Migrations
|
||||
{
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20251105002123_2025-11-04_00_PlayData")]
|
||||
partial class _20251104_00_PlayData
|
||||
[Migration("20251117210121_PlayData")]
|
||||
partial class PlayData
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -1022,6 +1022,12 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int?>("ApplicationAtRiskCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ApplicationCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ApplicationData")
|
||||
.HasColumnType("text");
|
||||
|
||||
@@ -1032,9 +1038,39 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int?>("CriticalApplicationAtRiskCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("CriticalApplicationCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("CriticalMemberAtRiskCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("CriticalMemberCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("CriticalPasswordAtRiskCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("CriticalPasswordCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MemberAtRiskCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MemberCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("OrganizationId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int?>("PasswordAtRiskCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("PasswordCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ReportData")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
@@ -1629,28 +1665,6 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SeededData", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RecipeName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SeededData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -0,0 +1,96 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -1662,28 +1662,6 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SeededData", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RecipeName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SeededData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
||||
Reference in New Issue
Block a user