mirror of
https://github.com/bitwarden/server.git
synced 2025-06-25 13:18:48 -05:00
PM-20574 updating sql scripts
This commit is contained in:
parent
dfca2f7bf3
commit
8f996a0678
@ -19,6 +19,12 @@ public class OrganizationApplicationEntityTypeConfiguration : IEntityTypeConfigu
|
|||||||
.HasIndex(s => s.OrganizationId)
|
.HasIndex(s => s.OrganizationId)
|
||||||
.IsClustered(false);
|
.IsClustered(false);
|
||||||
|
|
||||||
|
builder
|
||||||
|
.HasOne(s => s.Organization)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(s => s.OrganizationId)
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
builder.ToTable(nameof(OrganizationApplication));
|
builder.ToTable(nameof(OrganizationApplication));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,12 @@ public class OrganizationReportEntityTypeConfiguration : IEntityTypeConfiguratio
|
|||||||
.HasIndex(s => s.OrganizationId)
|
.HasIndex(s => s.OrganizationId)
|
||||||
.IsClustered(false);
|
.IsClustered(false);
|
||||||
|
|
||||||
|
builder
|
||||||
|
.HasOne(s => s.Organization)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(s => s.OrganizationId)
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
builder.ToTable(nameof(OrganizationReport));
|
builder.ToTable(nameof(OrganizationReport));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,20 @@ BEGIN
|
|||||||
WHERE
|
WHERE
|
||||||
[OrganizationId] = @Id
|
[OrganizationId] = @Id
|
||||||
|
|
||||||
|
-- Delete Organization Application
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[OrganizationApplication]
|
||||||
|
WHERE
|
||||||
|
[Id] = @Id
|
||||||
|
|
||||||
|
-- Delete Organization Report
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[OrganizationReport]
|
||||||
|
WHERE
|
||||||
|
[Id] = @Id
|
||||||
|
|
||||||
DELETE
|
DELETE
|
||||||
FROM
|
FROM
|
||||||
[dbo].[Organization]
|
[dbo].[Organization]
|
||||||
|
@ -0,0 +1,161 @@
|
|||||||
|
CREATE OR ALTER PROCEDURE [dbo].[dbo].[Organization_DeleteById]
|
||||||
|
@OrganizationId UNIQUEIDENTIFIER
|
||||||
|
WITH RECOMPILE
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON
|
||||||
|
|
||||||
|
EXEC [dbo].[User_BumpAccountRevisionDateByOrganizationId] @Id
|
||||||
|
|
||||||
|
DECLARE @BatchSize INT = 100
|
||||||
|
WHILE @BatchSize > 0
|
||||||
|
BEGIN
|
||||||
|
BEGIN TRANSACTION Organization_DeleteById_Ciphers
|
||||||
|
|
||||||
|
DELETE TOP(@BatchSize)
|
||||||
|
FROM
|
||||||
|
[dbo].[Cipher]
|
||||||
|
WHERE
|
||||||
|
[UserId] IS NULL
|
||||||
|
AND [OrganizationId] = @Id
|
||||||
|
|
||||||
|
SET @BatchSize = @@ROWCOUNT
|
||||||
|
|
||||||
|
COMMIT TRANSACTION Organization_DeleteById_Ciphers
|
||||||
|
END
|
||||||
|
|
||||||
|
BEGIN TRANSACTION Organization_DeleteById
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[AuthRequest]
|
||||||
|
WHERE
|
||||||
|
[OrganizationId] = @Id
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[SsoUser]
|
||||||
|
WHERE
|
||||||
|
[OrganizationId] = @Id
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[SsoConfig]
|
||||||
|
WHERE
|
||||||
|
[OrganizationId] = @Id
|
||||||
|
|
||||||
|
DELETE CU
|
||||||
|
FROM
|
||||||
|
[dbo].[CollectionUser] CU
|
||||||
|
INNER JOIN
|
||||||
|
[dbo].[OrganizationUser] OU ON [CU].[OrganizationUserId] = [OU].[Id]
|
||||||
|
WHERE
|
||||||
|
[OU].[OrganizationId] = @Id
|
||||||
|
|
||||||
|
DELETE AP
|
||||||
|
FROM
|
||||||
|
[dbo].[AccessPolicy] AP
|
||||||
|
INNER JOIN
|
||||||
|
[dbo].[OrganizationUser] OU ON [AP].[OrganizationUserId] = [OU].[Id]
|
||||||
|
WHERE
|
||||||
|
[OU].[OrganizationId] = @Id
|
||||||
|
|
||||||
|
DELETE GU
|
||||||
|
FROM
|
||||||
|
[dbo].[GroupUser] GU
|
||||||
|
INNER JOIN
|
||||||
|
[dbo].[OrganizationUser] OU ON [GU].[OrganizationUserId] = [OU].[Id]
|
||||||
|
WHERE
|
||||||
|
[OU].[OrganizationId] = @Id
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[OrganizationUser]
|
||||||
|
WHERE
|
||||||
|
[OrganizationId] = @Id
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[ProviderOrganization]
|
||||||
|
WHERE
|
||||||
|
[OrganizationId] = @Id
|
||||||
|
|
||||||
|
EXEC [dbo].[OrganizationApiKey_OrganizationDeleted] @Id
|
||||||
|
EXEC [dbo].[OrganizationConnection_OrganizationDeleted] @Id
|
||||||
|
EXEC [dbo].[OrganizationSponsorship_OrganizationDeleted] @Id
|
||||||
|
EXEC [dbo].[OrganizationDomain_OrganizationDeleted] @Id
|
||||||
|
EXEC [dbo].[OrganizationIntegration_OrganizationDeleted] @Id
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[Project]
|
||||||
|
WHERE
|
||||||
|
[OrganizationId] = @Id
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[Secret]
|
||||||
|
WHERE
|
||||||
|
[OrganizationId] = @Id
|
||||||
|
|
||||||
|
DELETE AK
|
||||||
|
FROM
|
||||||
|
[dbo].[ApiKey] AK
|
||||||
|
INNER JOIN
|
||||||
|
[dbo].[ServiceAccount] SA ON [AK].[ServiceAccountId] = [SA].[Id]
|
||||||
|
WHERE
|
||||||
|
[SA].[OrganizationId] = @Id
|
||||||
|
|
||||||
|
DELETE AP
|
||||||
|
FROM
|
||||||
|
[dbo].[AccessPolicy] AP
|
||||||
|
INNER JOIN
|
||||||
|
[dbo].[ServiceAccount] SA ON [AP].[GrantedServiceAccountId] = [SA].[Id]
|
||||||
|
WHERE
|
||||||
|
[SA].[OrganizationId] = @Id
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[ServiceAccount]
|
||||||
|
WHERE
|
||||||
|
[OrganizationId] = @Id
|
||||||
|
|
||||||
|
-- Delete Notification Status
|
||||||
|
DELETE
|
||||||
|
NS
|
||||||
|
FROM
|
||||||
|
[dbo].[NotificationStatus] NS
|
||||||
|
INNER JOIN
|
||||||
|
[dbo].[Notification] N ON N.[Id] = NS.[NotificationId]
|
||||||
|
WHERE
|
||||||
|
N.[OrganizationId] = @Id
|
||||||
|
|
||||||
|
-- Delete Notification
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[Notification]
|
||||||
|
WHERE
|
||||||
|
[OrganizationId] = @Id
|
||||||
|
|
||||||
|
-- Delete Organization Application
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[OrganizationApplication]
|
||||||
|
WHERE
|
||||||
|
[Id] = @Id
|
||||||
|
|
||||||
|
-- Delete Organization Report
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[OrganizationReport]
|
||||||
|
WHERE
|
||||||
|
[Id] = @Id
|
||||||
|
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
[dbo].[Organization]
|
||||||
|
WHERE
|
||||||
|
[Id] = @Id
|
||||||
|
|
||||||
|
COMMIT TRANSACTION Organization_DeleteById
|
||||||
|
END
|
3204
util/PostgresMigrations/Migrations/20250610164247_2025-06-10-00_OrganizationReport.sql.Designer.cs
generated
Normal file
3204
util/PostgresMigrations/Migrations/20250610164247_2025-06-10-00_OrganizationReport.sql.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,155 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Bit.PostgresMigrations.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class _2025061000_OrganizationReportsql : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RiskInsightCriticalApplication");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RiskInsightReport");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "OrganizationApplication",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
Applications = table.Column<string>(type: "text", nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
RevisionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_OrganizationApplication", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationApplication_Organization_OrganizationId",
|
||||||
|
column: x => x.OrganizationId,
|
||||||
|
principalTable: "Organization",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "OrganizationReport",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
ReportData = table.Column<string>(type: "text", nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
RevisionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_OrganizationReport", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationReport_Organization_OrganizationId",
|
||||||
|
column: x => x.OrganizationId,
|
||||||
|
principalTable: "Organization",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationApplication_Id",
|
||||||
|
table: "OrganizationApplication",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationApplication_OrganizationId",
|
||||||
|
table: "OrganizationApplication",
|
||||||
|
column: "OrganizationId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationReport_Id",
|
||||||
|
table: "OrganizationReport",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationReport_OrganizationId",
|
||||||
|
table: "OrganizationReport",
|
||||||
|
column: "OrganizationId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "OrganizationApplication");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "OrganizationReport");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RiskInsightCriticalApplication",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
Applications = table.Column<string>(type: "text", nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
RevisionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RiskInsightCriticalApplication", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RiskInsightCriticalApplication_Organization_OrganizationId",
|
||||||
|
column: x => x.OrganizationId,
|
||||||
|
principalTable: "Organization",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RiskInsightReport",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
OrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
ReportData = table.Column<string>(type: "text", nullable: false),
|
||||||
|
RevisionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RiskInsightReport", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RiskInsightReport_Organization_OrganizationId",
|
||||||
|
column: x => x.OrganizationId,
|
||||||
|
principalTable: "Organization",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RiskInsightCriticalApplication_Id",
|
||||||
|
table: "RiskInsightCriticalApplication",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RiskInsightCriticalApplication_OrganizationId",
|
||||||
|
table: "RiskInsightCriticalApplication",
|
||||||
|
column: "OrganizationId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RiskInsightReport_Id",
|
||||||
|
table: "RiskInsightReport",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RiskInsightReport_OrganizationId",
|
||||||
|
table: "RiskInsightReport",
|
||||||
|
column: "OrganizationId");
|
||||||
|
}
|
||||||
|
}
|
@ -925,35 +925,7 @@ namespace Bit.PostgresMigrations.Migrations
|
|||||||
b.ToTable("ProviderPlan", (string)null);
|
b.ToTable("ProviderPlan", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.PasswordHealthReportApplication", b =>
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationApplication", b =>
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreationDate")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<Guid>("OrganizationId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTime>("RevisionDate")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Uri")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.HasAnnotation("SqlServer:Clustered", true);
|
|
||||||
|
|
||||||
b.HasIndex("OrganizationId")
|
|
||||||
.HasAnnotation("SqlServer:Clustered", false);
|
|
||||||
|
|
||||||
b.ToTable("PasswordHealthReportApplication", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.RiskInsightCriticalApplication", b =>
|
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
@ -979,10 +951,10 @@ namespace Bit.PostgresMigrations.Migrations
|
|||||||
b.HasIndex("OrganizationId")
|
b.HasIndex("OrganizationId")
|
||||||
.HasAnnotation("SqlServer:Clustered", false);
|
.HasAnnotation("SqlServer:Clustered", false);
|
||||||
|
|
||||||
b.ToTable("RiskInsightCriticalApplication", (string)null);
|
b.ToTable("OrganizationApplication", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.RiskInsightReport", b =>
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationReport", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
@ -1011,7 +983,35 @@ namespace Bit.PostgresMigrations.Migrations
|
|||||||
b.HasIndex("OrganizationId")
|
b.HasIndex("OrganizationId")
|
||||||
.HasAnnotation("SqlServer:Clustered", false);
|
.HasAnnotation("SqlServer:Clustered", false);
|
||||||
|
|
||||||
b.ToTable("RiskInsightReport", (string)null);
|
b.ToTable("OrganizationReport", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.PasswordHealthReportApplication", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<Guid>("OrganizationId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<DateTime>("RevisionDate")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("Uri")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.HasAnnotation("SqlServer:Clustered", true);
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationId")
|
||||||
|
.HasAnnotation("SqlServer:Clustered", false);
|
||||||
|
|
||||||
|
b.ToTable("PasswordHealthReportApplication", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cache", b =>
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cache", b =>
|
||||||
@ -2589,6 +2589,28 @@ namespace Bit.PostgresMigrations.Migrations
|
|||||||
b.Navigation("Provider");
|
b.Navigation("Provider");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationApplication", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Organization");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationReport", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Organization");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.PasswordHealthReportApplication", b =>
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.PasswordHealthReportApplication", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
||||||
@ -2600,28 +2622,6 @@ namespace Bit.PostgresMigrations.Migrations
|
|||||||
b.Navigation("Organization");
|
b.Navigation("Organization");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.RiskInsightCriticalApplication", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("OrganizationId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Organization");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.RiskInsightReport", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("OrganizationId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Organization");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b =>
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
||||||
|
3187
util/SqliteMigrations/Migrations/20250610164244_2025-06-10-00_OrganizationReport.sql.Designer.cs
generated
Normal file
3187
util/SqliteMigrations/Migrations/20250610164244_2025-06-10-00_OrganizationReport.sql.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,155 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Bit.SqliteMigrations.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class _2025061000_OrganizationReportsql : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RiskInsightCriticalApplication");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RiskInsightReport");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "OrganizationApplication",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
|
OrganizationId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
|
Applications = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
|
RevisionDate = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_OrganizationApplication", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationApplication_Organization_OrganizationId",
|
||||||
|
column: x => x.OrganizationId,
|
||||||
|
principalTable: "Organization",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "OrganizationReport",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
|
OrganizationId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
|
Date = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
|
ReportData = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
|
RevisionDate = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_OrganizationReport", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationReport_Organization_OrganizationId",
|
||||||
|
column: x => x.OrganizationId,
|
||||||
|
principalTable: "Organization",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationApplication_Id",
|
||||||
|
table: "OrganizationApplication",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationApplication_OrganizationId",
|
||||||
|
table: "OrganizationApplication",
|
||||||
|
column: "OrganizationId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationReport_Id",
|
||||||
|
table: "OrganizationReport",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationReport_OrganizationId",
|
||||||
|
table: "OrganizationReport",
|
||||||
|
column: "OrganizationId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "OrganizationApplication");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "OrganizationReport");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RiskInsightCriticalApplication",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
|
OrganizationId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
|
Applications = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
|
RevisionDate = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RiskInsightCriticalApplication", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RiskInsightCriticalApplication_Organization_OrganizationId",
|
||||||
|
column: x => x.OrganizationId,
|
||||||
|
principalTable: "Organization",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RiskInsightReport",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
|
OrganizationId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||||
|
CreationDate = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
|
Date = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
|
ReportData = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
|
RevisionDate = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RiskInsightReport", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RiskInsightReport_Organization_OrganizationId",
|
||||||
|
column: x => x.OrganizationId,
|
||||||
|
principalTable: "Organization",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RiskInsightCriticalApplication_Id",
|
||||||
|
table: "RiskInsightCriticalApplication",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RiskInsightCriticalApplication_OrganizationId",
|
||||||
|
table: "RiskInsightCriticalApplication",
|
||||||
|
column: "OrganizationId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RiskInsightReport_Id",
|
||||||
|
table: "RiskInsightReport",
|
||||||
|
column: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RiskInsightReport_OrganizationId",
|
||||||
|
table: "RiskInsightReport",
|
||||||
|
column: "OrganizationId");
|
||||||
|
}
|
||||||
|
}
|
@ -909,35 +909,7 @@ namespace Bit.SqliteMigrations.Migrations
|
|||||||
b.ToTable("ProviderPlan", (string)null);
|
b.ToTable("ProviderPlan", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.PasswordHealthReportApplication", b =>
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationApplication", b =>
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreationDate")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<Guid>("OrganizationId")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<DateTime>("RevisionDate")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Uri")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("Id")
|
|
||||||
.HasAnnotation("SqlServer:Clustered", true);
|
|
||||||
|
|
||||||
b.HasIndex("OrganizationId")
|
|
||||||
.HasAnnotation("SqlServer:Clustered", false);
|
|
||||||
|
|
||||||
b.ToTable("PasswordHealthReportApplication", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.RiskInsightCriticalApplication", b =>
|
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
@ -963,10 +935,10 @@ namespace Bit.SqliteMigrations.Migrations
|
|||||||
b.HasIndex("OrganizationId")
|
b.HasIndex("OrganizationId")
|
||||||
.HasAnnotation("SqlServer:Clustered", false);
|
.HasAnnotation("SqlServer:Clustered", false);
|
||||||
|
|
||||||
b.ToTable("RiskInsightCriticalApplication", (string)null);
|
b.ToTable("OrganizationApplication", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.RiskInsightReport", b =>
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationReport", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
@ -995,7 +967,35 @@ namespace Bit.SqliteMigrations.Migrations
|
|||||||
b.HasIndex("OrganizationId")
|
b.HasIndex("OrganizationId")
|
||||||
.HasAnnotation("SqlServer:Clustered", false);
|
.HasAnnotation("SqlServer:Clustered", false);
|
||||||
|
|
||||||
b.ToTable("RiskInsightReport", (string)null);
|
b.ToTable("OrganizationReport", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.PasswordHealthReportApplication", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<Guid>("OrganizationId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("RevisionDate")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Uri")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("Id")
|
||||||
|
.HasAnnotation("SqlServer:Clustered", true);
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationId")
|
||||||
|
.HasAnnotation("SqlServer:Clustered", false);
|
||||||
|
|
||||||
|
b.ToTable("PasswordHealthReportApplication", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cache", b =>
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cache", b =>
|
||||||
@ -2572,6 +2572,28 @@ namespace Bit.SqliteMigrations.Migrations
|
|||||||
b.Navigation("Provider");
|
b.Navigation("Provider");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationApplication", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Organization");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.OrganizationReport", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Organization");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.PasswordHealthReportApplication", b =>
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.PasswordHealthReportApplication", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
||||||
@ -2583,28 +2605,6 @@ namespace Bit.SqliteMigrations.Migrations
|
|||||||
b.Navigation("Organization");
|
b.Navigation("Organization");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.RiskInsightCriticalApplication", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("OrganizationId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Organization");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Dirt.Models.RiskInsightReport", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("OrganizationId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Organization");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b =>
|
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user