server management
This commit is contained in:
4580
src/EntKube.Web/Data/Migrations/Sqlite/20260609100644_AddAppRoutes.Designer.cs
generated
Normal file
4580
src/EntKube.Web/Data/Migrations/Sqlite/20260609100644_AddAppRoutes.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddAppRoutes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppRoutes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
AppId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Hostname = table.Column<string>(type: "TEXT", maxLength: 253, nullable: false),
|
||||
TlsMode = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
|
||||
ClusterIssuerName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true),
|
||||
TlsCertificate = table.Column<string>(type: "TEXT", nullable: true),
|
||||
TlsPrivateKey = table.Column<string>(type: "TEXT", nullable: true),
|
||||
IsEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppRoutes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppRoutes_Apps_AppId",
|
||||
column: x => x.AppId,
|
||||
principalTable: "Apps",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppDeploymentRoutes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
AppRouteId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
AppDeploymentId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
PathPrefix = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
||||
ServiceName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
||||
ServicePort = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
GatewayName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true),
|
||||
GatewayNamespace = table.Column<string>(type: "TEXT", maxLength: 63, nullable: true),
|
||||
IsEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
LastHealthCheckAt = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
LastStatusCode = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
IsReachable = table.Column<bool>(type: "INTEGER", nullable: true),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppDeploymentRoutes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppDeploymentRoutes_AppDeployments_AppDeploymentId",
|
||||
column: x => x.AppDeploymentId,
|
||||
principalTable: "AppDeployments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppDeploymentRoutes_AppRoutes_AppRouteId",
|
||||
column: x => x.AppRouteId,
|
||||
principalTable: "AppRoutes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppDeploymentRoutes_AppDeploymentId",
|
||||
table: "AppDeploymentRoutes",
|
||||
column: "AppDeploymentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppDeploymentRoutes_AppRouteId",
|
||||
table: "AppDeploymentRoutes",
|
||||
column: "AppRouteId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppRoutes_AppId",
|
||||
table: "AppRoutes",
|
||||
column: "AppId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppDeploymentRoutes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppRoutes");
|
||||
}
|
||||
}
|
||||
}
|
||||
4619
src/EntKube.Web/Data/Migrations/Sqlite/20260609111905_GovernancePerEnvironment.Designer.cs
generated
Normal file
4619
src/EntKube.Web/Data/Migrations/Sqlite/20260609111905_GovernancePerEnvironment.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,179 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class GovernancePerEnvironment : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AppRbacPolicies_AppId",
|
||||
table: "AppRbacPolicies");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AppQuotas_AppId",
|
||||
table: "AppQuotas");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AppNetworkPolicies_AppId_Name",
|
||||
table: "AppNetworkPolicies");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "EnvironmentId",
|
||||
table: "AppRbacPolicies",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "EnvironmentId",
|
||||
table: "AppQuotas",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "EnvironmentId",
|
||||
table: "AppNetworkPolicies",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppRbacPolicies_AppId_EnvironmentId",
|
||||
table: "AppRbacPolicies",
|
||||
columns: new[] { "AppId", "EnvironmentId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppRbacPolicies_EnvironmentId",
|
||||
table: "AppRbacPolicies",
|
||||
column: "EnvironmentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppQuotas_AppId_EnvironmentId",
|
||||
table: "AppQuotas",
|
||||
columns: new[] { "AppId", "EnvironmentId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppQuotas_EnvironmentId",
|
||||
table: "AppQuotas",
|
||||
column: "EnvironmentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppNetworkPolicies_AppId_EnvironmentId_Name",
|
||||
table: "AppNetworkPolicies",
|
||||
columns: new[] { "AppId", "EnvironmentId", "Name" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppNetworkPolicies_EnvironmentId",
|
||||
table: "AppNetworkPolicies",
|
||||
column: "EnvironmentId");
|
||||
|
||||
migrationBuilder.Sql("DELETE FROM AppQuotas WHERE EnvironmentId = '00000000-0000-0000-0000-000000000000'");
|
||||
migrationBuilder.Sql("DELETE FROM AppNetworkPolicies WHERE EnvironmentId = '00000000-0000-0000-0000-000000000000'");
|
||||
migrationBuilder.Sql("DELETE FROM AppRbacPolicies WHERE EnvironmentId = '00000000-0000-0000-0000-000000000000'");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AppNetworkPolicies_Environments_EnvironmentId",
|
||||
table: "AppNetworkPolicies",
|
||||
column: "EnvironmentId",
|
||||
principalTable: "Environments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AppQuotas_Environments_EnvironmentId",
|
||||
table: "AppQuotas",
|
||||
column: "EnvironmentId",
|
||||
principalTable: "Environments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AppRbacPolicies_Environments_EnvironmentId",
|
||||
table: "AppRbacPolicies",
|
||||
column: "EnvironmentId",
|
||||
principalTable: "Environments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AppNetworkPolicies_Environments_EnvironmentId",
|
||||
table: "AppNetworkPolicies");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AppQuotas_Environments_EnvironmentId",
|
||||
table: "AppQuotas");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AppRbacPolicies_Environments_EnvironmentId",
|
||||
table: "AppRbacPolicies");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AppRbacPolicies_AppId_EnvironmentId",
|
||||
table: "AppRbacPolicies");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AppRbacPolicies_EnvironmentId",
|
||||
table: "AppRbacPolicies");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AppQuotas_AppId_EnvironmentId",
|
||||
table: "AppQuotas");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AppQuotas_EnvironmentId",
|
||||
table: "AppQuotas");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AppNetworkPolicies_AppId_EnvironmentId_Name",
|
||||
table: "AppNetworkPolicies");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AppNetworkPolicies_EnvironmentId",
|
||||
table: "AppNetworkPolicies");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EnvironmentId",
|
||||
table: "AppRbacPolicies");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EnvironmentId",
|
||||
table: "AppQuotas");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EnvironmentId",
|
||||
table: "AppNetworkPolicies");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppRbacPolicies_AppId",
|
||||
table: "AppRbacPolicies",
|
||||
column: "AppId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppQuotas_AppId",
|
||||
table: "AppQuotas",
|
||||
column: "AppId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppNetworkPolicies_AppId_Name",
|
||||
table: "AppNetworkPolicies",
|
||||
columns: new[] { "AppId", "Name" },
|
||||
unique: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
4645
src/EntKube.Web/Data/Migrations/Sqlite/20260609115702_GitPerEnvironment.Designer.cs
generated
Normal file
4645
src/EntKube.Web/Data/Migrations/Sqlite/20260609115702_GitPerEnvironment.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class GitPerEnvironment : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_CustomerGitRepoPolicies_CustomerId_UrlPattern",
|
||||
table: "CustomerGitRepoPolicies");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_CustomerGitCredentials_CustomerId_Name",
|
||||
table: "CustomerGitCredentials");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "EnvironmentId",
|
||||
table: "CustomerGitRepoPolicies",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "EnvironmentId",
|
||||
table: "CustomerGitCredentials",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CustomerGitRepoPolicies_CustomerId_EnvironmentId_UrlPattern",
|
||||
table: "CustomerGitRepoPolicies",
|
||||
columns: new[] { "CustomerId", "EnvironmentId", "UrlPattern" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CustomerGitRepoPolicies_EnvironmentId",
|
||||
table: "CustomerGitRepoPolicies",
|
||||
column: "EnvironmentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CustomerGitCredentials_CustomerId_EnvironmentId_Name",
|
||||
table: "CustomerGitCredentials",
|
||||
columns: new[] { "CustomerId", "EnvironmentId", "Name" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CustomerGitCredentials_EnvironmentId",
|
||||
table: "CustomerGitCredentials",
|
||||
column: "EnvironmentId");
|
||||
|
||||
migrationBuilder.Sql("DELETE FROM CustomerGitRepoPolicies WHERE EnvironmentId = '00000000-0000-0000-0000-000000000000'");
|
||||
migrationBuilder.Sql("DELETE FROM CustomerGitCredentials WHERE EnvironmentId = '00000000-0000-0000-0000-000000000000'");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CustomerGitCredentials_Environments_EnvironmentId",
|
||||
table: "CustomerGitCredentials",
|
||||
column: "EnvironmentId",
|
||||
principalTable: "Environments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CustomerGitRepoPolicies_Environments_EnvironmentId",
|
||||
table: "CustomerGitRepoPolicies",
|
||||
column: "EnvironmentId",
|
||||
principalTable: "Environments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CustomerGitCredentials_Environments_EnvironmentId",
|
||||
table: "CustomerGitCredentials");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CustomerGitRepoPolicies_Environments_EnvironmentId",
|
||||
table: "CustomerGitRepoPolicies");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_CustomerGitRepoPolicies_CustomerId_EnvironmentId_UrlPattern",
|
||||
table: "CustomerGitRepoPolicies");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_CustomerGitRepoPolicies_EnvironmentId",
|
||||
table: "CustomerGitRepoPolicies");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_CustomerGitCredentials_CustomerId_EnvironmentId_Name",
|
||||
table: "CustomerGitCredentials");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_CustomerGitCredentials_EnvironmentId",
|
||||
table: "CustomerGitCredentials");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EnvironmentId",
|
||||
table: "CustomerGitRepoPolicies");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EnvironmentId",
|
||||
table: "CustomerGitCredentials");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CustomerGitRepoPolicies_CustomerId_UrlPattern",
|
||||
table: "CustomerGitRepoPolicies",
|
||||
columns: new[] { "CustomerId", "UrlPattern" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CustomerGitCredentials_CustomerId_Name",
|
||||
table: "CustomerGitCredentials",
|
||||
columns: new[] { "CustomerId", "Name" },
|
||||
unique: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
4648
src/EntKube.Web/Data/Migrations/Sqlite/20260609125708_AddAppEnvironmentNamespace.Designer.cs
generated
Normal file
4648
src/EntKube.Web/Data/Migrations/Sqlite/20260609125708_AddAppEnvironmentNamespace.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddAppEnvironmentNamespace : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Namespace",
|
||||
table: "AppEnvironments",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Namespace",
|
||||
table: "AppEnvironments");
|
||||
}
|
||||
}
|
||||
}
|
||||
4852
src/EntKube.Web/Data/Migrations/Sqlite/20260609171012_AddGovernanceAllowlists.Designer.cs
generated
Normal file
4852
src/EntKube.Web/Data/Migrations/Sqlite/20260609171012_AddGovernanceAllowlists.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,196 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddGovernanceAllowlists : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppAllowedCaches",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
AppId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
EnvironmentId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
RedisClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppAllowedCaches", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppAllowedCaches_Apps_AppId",
|
||||
column: x => x.AppId,
|
||||
principalTable: "Apps",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppAllowedCaches_Environments_EnvironmentId",
|
||||
column: x => x.EnvironmentId,
|
||||
principalTable: "Environments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppAllowedCaches_RedisClusters_RedisClusterId",
|
||||
column: x => x.RedisClusterId,
|
||||
principalTable: "RedisClusters",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppAllowedDatabases",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
AppId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
EnvironmentId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
CnpgDatabaseId = table.Column<Guid>(type: "TEXT", nullable: true),
|
||||
MongoDatabaseId = table.Column<Guid>(type: "TEXT", nullable: true),
|
||||
RegisteredPostgresDatabaseId = table.Column<Guid>(type: "TEXT", nullable: true),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppAllowedDatabases", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppAllowedDatabases_Apps_AppId",
|
||||
column: x => x.AppId,
|
||||
principalTable: "Apps",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppAllowedDatabases_CnpgDatabases_CnpgDatabaseId",
|
||||
column: x => x.CnpgDatabaseId,
|
||||
principalTable: "CnpgDatabases",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppAllowedDatabases_Environments_EnvironmentId",
|
||||
column: x => x.EnvironmentId,
|
||||
principalTable: "Environments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppAllowedDatabases_MongoDatabases_MongoDatabaseId",
|
||||
column: x => x.MongoDatabaseId,
|
||||
principalTable: "MongoDatabases",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppAllowedDatabases_RegisteredPostgresDatabases_RegisteredPostgresDatabaseId",
|
||||
column: x => x.RegisteredPostgresDatabaseId,
|
||||
principalTable: "RegisteredPostgresDatabases",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AppAllowedStorages",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
AppId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
EnvironmentId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
StorageLinkId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AppAllowedStorages", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppAllowedStorages_Apps_AppId",
|
||||
column: x => x.AppId,
|
||||
principalTable: "Apps",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppAllowedStorages_Environments_EnvironmentId",
|
||||
column: x => x.EnvironmentId,
|
||||
principalTable: "Environments",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_AppAllowedStorages_StorageLinks_StorageLinkId",
|
||||
column: x => x.StorageLinkId,
|
||||
principalTable: "StorageLinks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAllowedCaches_AppId",
|
||||
table: "AppAllowedCaches",
|
||||
column: "AppId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAllowedCaches_EnvironmentId",
|
||||
table: "AppAllowedCaches",
|
||||
column: "EnvironmentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAllowedCaches_RedisClusterId",
|
||||
table: "AppAllowedCaches",
|
||||
column: "RedisClusterId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAllowedDatabases_AppId",
|
||||
table: "AppAllowedDatabases",
|
||||
column: "AppId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAllowedDatabases_CnpgDatabaseId",
|
||||
table: "AppAllowedDatabases",
|
||||
column: "CnpgDatabaseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAllowedDatabases_EnvironmentId",
|
||||
table: "AppAllowedDatabases",
|
||||
column: "EnvironmentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAllowedDatabases_MongoDatabaseId",
|
||||
table: "AppAllowedDatabases",
|
||||
column: "MongoDatabaseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAllowedDatabases_RegisteredPostgresDatabaseId",
|
||||
table: "AppAllowedDatabases",
|
||||
column: "RegisteredPostgresDatabaseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAllowedStorages_AppId",
|
||||
table: "AppAllowedStorages",
|
||||
column: "AppId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAllowedStorages_EnvironmentId",
|
||||
table: "AppAllowedStorages",
|
||||
column: "EnvironmentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AppAllowedStorages_StorageLinkId",
|
||||
table: "AppAllowedStorages",
|
||||
column: "StorageLinkId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppAllowedCaches");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppAllowedDatabases");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AppAllowedStorages");
|
||||
}
|
||||
}
|
||||
}
|
||||
4652
src/EntKube.Web/Data/Migrations/Sqlite/20260609200000_AddCredentialUrlPattern.Designer.cs
generated
Normal file
4652
src/EntKube.Web/Data/Migrations/Sqlite/20260609200000_AddCredentialUrlPattern.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddCredentialUrlPattern : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "UrlPattern",
|
||||
table: "CustomerGitCredentials",
|
||||
type: "TEXT",
|
||||
maxLength: 500,
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UrlPattern",
|
||||
table: "CustomerGitCredentials");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddDeploymentRouteApplied : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "ClusterAppliedAt",
|
||||
table: "AppDeploymentRoutes",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ClusterAppliedAt",
|
||||
table: "AppDeploymentRoutes");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddVaultSecretVersions : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "UpdatedBy",
|
||||
table: "VaultSecrets",
|
||||
type: "TEXT",
|
||||
maxLength: 254,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "VaultSecretVersions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
SecretId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
VersionNumber = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
EncryptedValue = table.Column<byte[]>(type: "BLOB", nullable: false),
|
||||
Nonce = table.Column<byte[]>(type: "BLOB", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "TEXT", maxLength: 254, nullable: true),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_VaultSecretVersions", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_VaultSecretVersions_VaultSecrets_SecretId",
|
||||
column: x => x.SecretId,
|
||||
principalTable: "VaultSecrets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_VaultSecretVersions_SecretId_VersionNumber",
|
||||
table: "VaultSecretVersions",
|
||||
columns: new[] { "SecretId", "VersionNumber" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "VaultSecretVersions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdatedBy",
|
||||
table: "VaultSecrets");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using EntKube.Web.Data;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20260611000000_AddOpsTeamFeatures")]
|
||||
public partial class AddOpsTeamFeatures : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AssignedTo",
|
||||
table: "AlertIncidents",
|
||||
type: "TEXT",
|
||||
maxLength: 256,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "AssignedAt",
|
||||
table: "AlertIncidents",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "OnCallSchedules",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
||||
Description = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true),
|
||||
IsEnabled = table.Column<bool>(type: "INTEGER", nullable: false, defaultValue: true),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OnCallSchedules", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_OnCallSchedules_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "OnCallShifts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
ScheduleId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
AssigneeName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
|
||||
AssigneeEmail = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
|
||||
StartsAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
EndsAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
Notes = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OnCallShifts", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_OnCallShifts_OnCallSchedules_ScheduleId",
|
||||
column: x => x.ScheduleId,
|
||||
principalTable: "OnCallSchedules",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AlertRoutingRules",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
||||
Priority = table.Column<int>(type: "INTEGER", nullable: false, defaultValue: 0),
|
||||
ChannelId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
MatchAlertName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true),
|
||||
MatchNamespace = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true),
|
||||
MatchSeverity = table.Column<string>(type: "TEXT", maxLength: 20, nullable: true),
|
||||
MatchLabelKey = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
|
||||
MatchLabelValue = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true),
|
||||
IsEnabled = table.Column<bool>(type: "INTEGER", nullable: false, defaultValue: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AlertRoutingRules", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AlertRoutingRules_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AlertRoutingRules_NotificationChannels_ChannelId",
|
||||
column: x => x.ChannelId,
|
||||
principalTable: "NotificationChannels",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OnCallShifts_ScheduleId",
|
||||
table: "OnCallShifts",
|
||||
column: "ScheduleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OnCallShifts_StartsAt",
|
||||
table: "OnCallShifts",
|
||||
column: "StartsAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AlertRoutingRules_TenantId",
|
||||
table: "AlertRoutingRules",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AlertRoutingRules_ChannelId",
|
||||
table: "AlertRoutingRules",
|
||||
column: "ChannelId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AlertRoutingRules");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "OnCallShifts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "OnCallSchedules");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AssignedTo",
|
||||
table: "AlertIncidents");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AssignedAt",
|
||||
table: "AlertIncidents");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using EntKube.Web.Data;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20260611010000_AddAlertIncidentRunbookUrl")]
|
||||
public partial class AddAlertIncidentRunbookUrl : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RunbookUrl",
|
||||
table: "AlertIncidents",
|
||||
type: "TEXT",
|
||||
maxLength: 500,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RunbookUrl",
|
||||
table: "AlertIncidents");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using EntKube.Web.Data;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20260611020000_AddAlertIncidentEscalation")]
|
||||
public partial class AddAlertIncidentEscalation : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "EscalatedAt",
|
||||
table: "AlertIncidents",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AlertIncidents_EscalatedAt",
|
||||
table: "AlertIncidents",
|
||||
column: "EscalatedAt");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AlertIncidents_EscalatedAt",
|
||||
table: "AlertIncidents");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EscalatedAt",
|
||||
table: "AlertIncidents");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
public partial class AddDeploymentGitUrl : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "GitUrl",
|
||||
table: "AppDeployments",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "GitUrl",
|
||||
table: "AppDeployments");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
public partial class AddNotificationProviderConfig : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "NotificationProviderConfigs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
ProviderType = table.Column<string>(type: "TEXT", maxLength: 30, nullable: false),
|
||||
ConfigurationJson = table.Column<string>(type: "TEXT", nullable: false),
|
||||
IsEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
UpdatedByUserId = table.Column<string>(type: "TEXT", maxLength: 450, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_NotificationProviderConfigs", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_NotificationProviderConfigs_ProviderType",
|
||||
table: "NotificationProviderConfigs",
|
||||
column: "ProviderType",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "NotificationProviderConfigs");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
public partial class AddAlertRoutingSuppression : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
// SQLite does not support ALTER COLUMN, so rebuild the table to make ChannelId nullable
|
||||
// and add the two new columns at the same time.
|
||||
migrationBuilder.Sql("PRAGMA foreign_keys = OFF;");
|
||||
|
||||
migrationBuilder.Sql("""
|
||||
CREATE TABLE "AlertRoutingRules_new" (
|
||||
"Id" TEXT NOT NULL CONSTRAINT "PK_AlertRoutingRules" PRIMARY KEY,
|
||||
"TenantId" TEXT NOT NULL,
|
||||
"Name" TEXT NOT NULL,
|
||||
"Priority" INTEGER NOT NULL DEFAULT 0,
|
||||
"ChannelId" TEXT,
|
||||
"MatchAlertName" TEXT,
|
||||
"MatchNamespace" TEXT,
|
||||
"MatchSeverity" TEXT,
|
||||
"MatchLabelKey" TEXT,
|
||||
"MatchLabelValue" TEXT,
|
||||
"IsEnabled" INTEGER NOT NULL DEFAULT 1,
|
||||
"SuppressIncident" INTEGER NOT NULL DEFAULT 0,
|
||||
"MatchClusterId" TEXT,
|
||||
CONSTRAINT "FK_AlertRoutingRules_Tenants_TenantId"
|
||||
FOREIGN KEY ("TenantId") REFERENCES "Tenants" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_AlertRoutingRules_NotificationChannels_ChannelId"
|
||||
FOREIGN KEY ("ChannelId") REFERENCES "NotificationChannels" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_AlertRoutingRules_KubernetesClusters_MatchClusterId"
|
||||
FOREIGN KEY ("MatchClusterId") REFERENCES "KubernetesClusters" ("Id") ON DELETE SET NULL
|
||||
);
|
||||
""");
|
||||
|
||||
migrationBuilder.Sql("""
|
||||
INSERT INTO "AlertRoutingRules_new"
|
||||
("Id","TenantId","Name","Priority","ChannelId","MatchAlertName","MatchNamespace",
|
||||
"MatchSeverity","MatchLabelKey","MatchLabelValue","IsEnabled","SuppressIncident","MatchClusterId")
|
||||
SELECT
|
||||
"Id","TenantId","Name","Priority","ChannelId","MatchAlertName","MatchNamespace",
|
||||
"MatchSeverity","MatchLabelKey","MatchLabelValue","IsEnabled", 0, NULL
|
||||
FROM "AlertRoutingRules";
|
||||
""");
|
||||
|
||||
migrationBuilder.DropTable("AlertRoutingRules");
|
||||
|
||||
migrationBuilder.Sql("""ALTER TABLE "AlertRoutingRules_new" RENAME TO "AlertRoutingRules";""");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_AlertRoutingRules_TenantId", "AlertRoutingRules", "TenantId");
|
||||
migrationBuilder.CreateIndex("IX_AlertRoutingRules_ChannelId", "AlertRoutingRules", "ChannelId");
|
||||
migrationBuilder.CreateIndex("IX_AlertRoutingRules_MatchClusterId", "AlertRoutingRules", "MatchClusterId");
|
||||
|
||||
migrationBuilder.Sql("PRAGMA foreign_keys = ON;");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql("PRAGMA foreign_keys = OFF;");
|
||||
|
||||
migrationBuilder.Sql("""
|
||||
CREATE TABLE "AlertRoutingRules_old" (
|
||||
"Id" TEXT NOT NULL CONSTRAINT "PK_AlertRoutingRules" PRIMARY KEY,
|
||||
"TenantId" TEXT NOT NULL,
|
||||
"Name" TEXT NOT NULL,
|
||||
"Priority" INTEGER NOT NULL DEFAULT 0,
|
||||
"ChannelId" TEXT NOT NULL,
|
||||
"MatchAlertName" TEXT,
|
||||
"MatchNamespace" TEXT,
|
||||
"MatchSeverity" TEXT,
|
||||
"MatchLabelKey" TEXT,
|
||||
"MatchLabelValue" TEXT,
|
||||
"IsEnabled" INTEGER NOT NULL DEFAULT 1,
|
||||
CONSTRAINT "FK_AlertRoutingRules_Tenants_TenantId"
|
||||
FOREIGN KEY ("TenantId") REFERENCES "Tenants" ("Id") ON DELETE CASCADE,
|
||||
CONSTRAINT "FK_AlertRoutingRules_NotificationChannels_ChannelId"
|
||||
FOREIGN KEY ("ChannelId") REFERENCES "NotificationChannels" ("Id") ON DELETE CASCADE
|
||||
);
|
||||
""");
|
||||
|
||||
migrationBuilder.Sql("""
|
||||
INSERT INTO "AlertRoutingRules_old"
|
||||
("Id","TenantId","Name","Priority","ChannelId","MatchAlertName","MatchNamespace",
|
||||
"MatchSeverity","MatchLabelKey","MatchLabelValue","IsEnabled")
|
||||
SELECT
|
||||
"Id","TenantId","Name","Priority",COALESCE("ChannelId",'00000000-0000-0000-0000-000000000000'),
|
||||
"MatchAlertName","MatchNamespace","MatchSeverity","MatchLabelKey","MatchLabelValue","IsEnabled"
|
||||
FROM "AlertRoutingRules"
|
||||
WHERE "SuppressIncident" = 0;
|
||||
""");
|
||||
|
||||
migrationBuilder.DropTable("AlertRoutingRules");
|
||||
|
||||
migrationBuilder.Sql("""ALTER TABLE "AlertRoutingRules_old" RENAME TO "AlertRoutingRules";""");
|
||||
|
||||
migrationBuilder.CreateIndex("IX_AlertRoutingRules_TenantId", "AlertRoutingRules", "TenantId");
|
||||
migrationBuilder.CreateIndex("IX_AlertRoutingRules_ChannelId", "AlertRoutingRules", "ChannelId");
|
||||
|
||||
migrationBuilder.Sql("PRAGMA foreign_keys = ON;");
|
||||
}
|
||||
}
|
||||
}
|
||||
5229
src/EntKube.Web/Data/Migrations/Sqlite/20260611122519_AddClusterServers.Designer.cs
generated
Normal file
5229
src/EntKube.Web/Data/Migrations/Sqlite/20260611122519_AddClusterServers.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,216 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace EntKube.Web.Data.Migrations.Sqlite
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddClusterServers : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_OnCallSchedules_TenantId",
|
||||
table: "OnCallSchedules");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "UpdatedBy",
|
||||
table: "VaultSecrets",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsEnabled",
|
||||
table: "OnCallSchedules",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "INTEGER",
|
||||
oldDefaultValue: true);
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "SuppressIncident",
|
||||
table: "AlertRoutingRules",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "INTEGER",
|
||||
oldDefaultValue: false);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Priority",
|
||||
table: "AlertRoutingRules",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "INTEGER",
|
||||
oldDefaultValue: 0);
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsEnabled",
|
||||
table: "AlertRoutingRules",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "INTEGER",
|
||||
oldDefaultValue: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "RunbookUrl",
|
||||
table: "AlertIncidents",
|
||||
type: "TEXT",
|
||||
maxLength: 500,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "TEXT",
|
||||
oldMaxLength: 500,
|
||||
oldDefaultValue: "");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ClusterServers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
ClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
NodeName = table.Column<string>(type: "TEXT", maxLength: 253, nullable: true),
|
||||
DisplayName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
||||
IpAddress = table.Column<string>(type: "TEXT", maxLength: 45, nullable: true),
|
||||
ManagementIpAddress = table.Column<string>(type: "TEXT", maxLength: 45, nullable: true),
|
||||
Provider = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
|
||||
OsDistribution = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true),
|
||||
CpuCores = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
RamGb = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
DiskGb = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
Location = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true),
|
||||
SshUser = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
|
||||
SshPort = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
JumpHost = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true),
|
||||
Notes = table.Column<string>(type: "TEXT", maxLength: 2000, nullable: true),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ClusterServers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ClusterServers_KubernetesClusters_ClusterId",
|
||||
column: x => x.ClusterId,
|
||||
principalTable: "KubernetesClusters",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "VaultSecretVersions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
SecretId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
VersionNumber = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
EncryptedValue = table.Column<byte[]>(type: "BLOB", nullable: false),
|
||||
Nonce = table.Column<byte[]>(type: "BLOB", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "TEXT", maxLength: 254, nullable: true),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_VaultSecretVersions", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_VaultSecretVersions_VaultSecrets_SecretId",
|
||||
column: x => x.SecretId,
|
||||
principalTable: "VaultSecrets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OnCallSchedules_TenantId_Name",
|
||||
table: "OnCallSchedules",
|
||||
columns: new[] { "TenantId", "Name" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ClusterServers_ClusterId_DisplayName",
|
||||
table: "ClusterServers",
|
||||
columns: new[] { "ClusterId", "DisplayName" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_VaultSecretVersions_SecretId_VersionNumber",
|
||||
table: "VaultSecretVersions",
|
||||
columns: new[] { "SecretId", "VersionNumber" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ClusterServers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "VaultSecretVersions");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_OnCallSchedules_TenantId_Name",
|
||||
table: "OnCallSchedules");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdatedBy",
|
||||
table: "VaultSecrets");
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsEnabled",
|
||||
table: "OnCallSchedules",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: true,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "INTEGER");
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "SuppressIncident",
|
||||
table: "AlertRoutingRules",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "INTEGER");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Priority",
|
||||
table: "AlertRoutingRules",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "INTEGER");
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsEnabled",
|
||||
table: "AlertRoutingRules",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: true,
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "INTEGER");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "RunbookUrl",
|
||||
table: "AlertIncidents",
|
||||
type: "TEXT",
|
||||
maxLength: 500,
|
||||
nullable: false,
|
||||
defaultValue: "",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "TEXT",
|
||||
oldMaxLength: 500);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OnCallSchedules_TenantId",
|
||||
table: "OnCallSchedules",
|
||||
column: "TenantId");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user