1
0
mirror of https://github.com/bitwarden/server synced 2025-12-14 15:23:42 +00:00

fixup seededData vs playData migrations

This commit is contained in:
Matt Gibson
2025-11-17 14:45:38 -08:00
parent 14044ff5fb
commit 1ebfac18a2
13 changed files with 404 additions and 433 deletions

View File

@@ -72,22 +72,4 @@ public class QueryControllerTests : IClassFixture<SeederApiApplicationFactory>,
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
} }
[Fact]
public async Task QueryEndpoint_VerifyQueryDoesNotCreateSeedId()
{
var testEmail = $"test-{Guid.NewGuid()}@bitwarden.com";
var response = await _client.PostAsJsonAsync("/query", new QueryRequestModel
{
Template = "EmergencyAccessInviteQuery",
Arguments = System.Text.Json.JsonSerializer.SerializeToElement(new { email = testEmail })
});
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
Assert.Equal("[]", result);
}
} }

View File

@@ -1,101 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.MySqlMigrations.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: "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.CreateTable(
name: "SeededData",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
RecipeName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Data = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SeededData", x => x.Id);
})
.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.DropTable(
name: "SeededData");
migrationBuilder.AlterColumn<int>(
name: "WaitTimeDays",
table: "EmergencyAccess",
type: "int",
nullable: false,
oldClrType: typeof(short),
oldType: "smallint");
}
}

View File

@@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Bit.MySqlMigrations.Migrations namespace Bit.MySqlMigrations.Migrations
{ {
[DbContext(typeof(DatabaseContext))] [DbContext(typeof(DatabaseContext))]
[Migration("20251105002110_2025-11-04_00_PlayData")] [Migration("20251117210114_PlayData")]
partial class _20251104_00_PlayData partial class PlayData
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -1017,6 +1017,12 @@ namespace Bit.MySqlMigrations.Migrations
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<int?>("ApplicationAtRiskCount")
.HasColumnType("int");
b.Property<int?>("ApplicationCount")
.HasColumnType("int");
b.Property<string>("ApplicationData") b.Property<string>("ApplicationData")
.HasColumnType("longtext"); .HasColumnType("longtext");
@@ -1027,9 +1033,39 @@ namespace Bit.MySqlMigrations.Migrations
b.Property<DateTime>("CreationDate") b.Property<DateTime>("CreationDate")
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
b.Property<int?>("CriticalApplicationAtRiskCount")
.HasColumnType("int");
b.Property<int?>("CriticalApplicationCount")
.HasColumnType("int");
b.Property<int?>("CriticalMemberAtRiskCount")
.HasColumnType("int");
b.Property<int?>("CriticalMemberCount")
.HasColumnType("int");
b.Property<int?>("CriticalPasswordAtRiskCount")
.HasColumnType("int");
b.Property<int?>("CriticalPasswordCount")
.HasColumnType("int");
b.Property<int?>("MemberAtRiskCount")
.HasColumnType("int");
b.Property<int?>("MemberCount")
.HasColumnType("int");
b.Property<Guid>("OrganizationId") b.Property<Guid>("OrganizationId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<int?>("PasswordAtRiskCount")
.HasColumnType("int");
b.Property<int?>("PasswordCount")
.HasColumnType("int");
b.Property<string>("ReportData") b.Property<string>("ReportData")
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
@@ -1624,28 +1660,6 @@ namespace Bit.MySqlMigrations.Migrations
}); });
}); });
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SeededData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime(6)");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("RecipeName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("SeededData");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")

View File

@@ -0,0 +1,98 @@
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

@@ -1657,28 +1657,6 @@ namespace Bit.MySqlMigrations.Migrations
}); });
}); });
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SeededData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime(6)");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("RecipeName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("SeededData");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b => modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")

View File

@@ -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");
}
}

View File

@@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Bit.PostgresMigrations.Migrations namespace Bit.PostgresMigrations.Migrations
{ {
[DbContext(typeof(DatabaseContext))] [DbContext(typeof(DatabaseContext))]
[Migration("20251105002123_2025-11-04_00_PlayData")] [Migration("20251117210121_PlayData")]
partial class _20251104_00_PlayData partial class PlayData
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -1022,6 +1022,12 @@ namespace Bit.PostgresMigrations.Migrations
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<int?>("ApplicationAtRiskCount")
.HasColumnType("integer");
b.Property<int?>("ApplicationCount")
.HasColumnType("integer");
b.Property<string>("ApplicationData") b.Property<string>("ApplicationData")
.HasColumnType("text"); .HasColumnType("text");
@@ -1032,9 +1038,39 @@ namespace Bit.PostgresMigrations.Migrations
b.Property<DateTime>("CreationDate") b.Property<DateTime>("CreationDate")
.HasColumnType("timestamp with time zone"); .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") b.Property<Guid>("OrganizationId")
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<int?>("PasswordAtRiskCount")
.HasColumnType("integer");
b.Property<int?>("PasswordCount")
.HasColumnType("integer");
b.Property<string>("ReportData") b.Property<string>("ReportData")
.IsRequired() .IsRequired()
.HasColumnType("text"); .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 => modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")

View File

@@ -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");
}
}

View File

@@ -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 => modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")

View File

@@ -1,80 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.SqliteMigrations.Migrations;
/// <inheritdoc />
public partial class _20251104_00_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.CreateTable(
name: "SeededData",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
RecipeName = table.Column<string>(type: "TEXT", nullable: false),
Data = table.Column<string>(type: "TEXT", nullable: false),
CreationDate = table.Column<DateTime>(type: "TEXT", 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");
}
}

View File

@@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Bit.SqliteMigrations.Migrations namespace Bit.SqliteMigrations.Migrations
{ {
[DbContext(typeof(DatabaseContext))] [DbContext(typeof(DatabaseContext))]
[Migration("20251105002117_2025-11-04_00_PlayData")] [Migration("20251117210127_PlayData")]
partial class _20251104_00_PlayData partial class PlayData
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -1006,6 +1006,12 @@ namespace Bit.SqliteMigrations.Migrations
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int?>("ApplicationAtRiskCount")
.HasColumnType("INTEGER");
b.Property<int?>("ApplicationCount")
.HasColumnType("INTEGER");
b.Property<string>("ApplicationData") b.Property<string>("ApplicationData")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
@@ -1016,9 +1022,39 @@ namespace Bit.SqliteMigrations.Migrations
b.Property<DateTime>("CreationDate") b.Property<DateTime>("CreationDate")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
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") b.Property<Guid>("OrganizationId")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int?>("PasswordAtRiskCount")
.HasColumnType("INTEGER");
b.Property<int?>("PasswordCount")
.HasColumnType("INTEGER");
b.Property<string>("ReportData") b.Property<string>("ReportData")
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
@@ -1613,28 +1649,6 @@ namespace Bit.SqliteMigrations.Migrations
}); });
}); });
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SeededData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreationDate")
.HasColumnType("TEXT");
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 => modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")

View File

@@ -0,0 +1,96 @@
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

@@ -1646,28 +1646,6 @@ namespace Bit.SqliteMigrations.Migrations
}); });
}); });
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SeededData", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreationDate")
.HasColumnType("TEXT");
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 => modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")