Skip to content

Commit

Permalink
Merge branch 'develop' into dr/toolbox-mock
Browse files Browse the repository at this point in the history
  • Loading branch information
davidreneuw committed Feb 12, 2025
2 parents 5c07091 + 977b4d1 commit 1738b10
Show file tree
Hide file tree
Showing 80 changed files with 16,173 additions and 468 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@

using Datahub.Core.Model.Projects;

namespace Datahub.Application.Services
{
public interface IProjectDeletionService
{
public Task<bool> DeleteWorkspace(string acronym);
public Task<bool> DeleteWorkspace(string acronym, Project_Delete_Questionnaire questionnaire);
}
}
11 changes: 11 additions & 0 deletions Portal/src/Datahub.Core/Data/EFTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static void InitializeDatabase<T>(ILogger logger, IConfiguration configur
where T : DbContext
{
using var context = factory.CreateDbContext();
logger.LogInformation($"Initializing database {GetInfo(context.Database)}-{typeof(T).Name} - reset:{resetDB} - migrate:{migrate}");
try
{
if (resetDB)
Expand All @@ -37,6 +38,16 @@ public static void InitializeDatabase<T>(ILogger logger, IConfiguration configur
{
if (migrate)
{
var pendingMigrations = context.Database.GetPendingMigrations();
if (pendingMigrations.Any())
{
logger.LogInformation("Pending migrations: {Migrations}", string.Join(", ", pendingMigrations));
}
else
{
logger.LogInformation("No pending migrations.");
}

context.Database.Migrate();
//TODO:
//GetMigrations()
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Datahub.Core.Migrations
{
/// <inheritdoc />
public partial class DeletedQuestionnaireTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{

migrationBuilder.CreateTable(
name: "Project_Delete_Questionnaires",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
IsWorkspaceNotRequired = table.Column<bool>(type: "bit", nullable: false),
IsDataMigrated = table.Column<bool>(type: "bit", nullable: false),
IsDataNotSubjectToLitigation = table.Column<bool>(type: "bit", nullable: false),
DoesDataNotHaveArchivalValue = table.Column<bool>(type: "bit", nullable: false),
IsDeletionConfirmed = table.Column<bool>(type: "bit", nullable: false),
DeletedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
Project_ID = table.Column<int>(type: "int", nullable: true),
DeletedById = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Project_Delete_Questionnaires", x => x.Id);
table.ForeignKey(
name: "FK_Project_Delete_Questionnaires_PortalUsers_DeletedById",
column: x => x.DeletedById,
principalTable: "PortalUsers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Project_Delete_Questionnaires_Projects_Project_ID",
column: x => x.Project_ID,
principalTable: "Projects",
principalColumn: "Project_ID");
});

migrationBuilder.CreateIndex(
name: "IX_Project_Delete_Questionnaires_DeletedById",
table: "Project_Delete_Questionnaires",
column: "DeletedById");

migrationBuilder.CreateIndex(
name: "IX_Project_Delete_Questionnaires_Project_ID",
table: "Project_Delete_Questionnaires",
column: "Project_ID");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Project_Delete_Questionnaires");

}
}
}
Loading

0 comments on commit 1738b10

Please sign in to comment.