first commit ish

This commit is contained in:
Nils Blomgren
2026-06-04 08:51:22 +02:00
parent e0f967482e
commit 658f15d086
320 changed files with 307404 additions and 1187 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddExternalKeycloak : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<Guid>(
name: "ClusterComponentId",
table: "KeycloakComponentConfigs",
type: "TEXT",
nullable: true,
oldClrType: typeof(Guid),
oldType: "TEXT");
migrationBuilder.AddColumn<string>(
name: "DisplayName",
table: "KeycloakComponentConfigs",
type: "TEXT",
maxLength: 200,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DisplayName",
table: "KeycloakComponentConfigs");
migrationBuilder.AlterColumn<Guid>(
name: "ClusterComponentId",
table: "KeycloakComponentConfigs",
type: "TEXT",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "TEXT",
oldNullable: true);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,82 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddKeycloakTheme : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "KeycloakThemeId",
table: "KeycloakRealms",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "KeycloakThemes",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
KeycloakComponentConfigId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
LoginTheme = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
AccountTheme = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_KeycloakThemes", x => x.Id);
table.ForeignKey(
name: "FK_KeycloakThemes_KeycloakComponentConfigs_KeycloakComponentConfigId",
column: x => x.KeycloakComponentConfigId,
principalTable: "KeycloakComponentConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_KeycloakRealms_KeycloakThemeId",
table: "KeycloakRealms",
column: "KeycloakThemeId");
migrationBuilder.CreateIndex(
name: "IX_KeycloakThemes_KeycloakComponentConfigId_Name",
table: "KeycloakThemes",
columns: new[] { "KeycloakComponentConfigId", "Name" },
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_KeycloakRealms_KeycloakThemes_KeycloakThemeId",
table: "KeycloakRealms",
column: "KeycloakThemeId",
principalTable: "KeycloakThemes",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_KeycloakRealms_KeycloakThemes_KeycloakThemeId",
table: "KeycloakRealms");
migrationBuilder.DropTable(
name: "KeycloakThemes");
migrationBuilder.DropIndex(
name: "IX_KeycloakRealms_KeycloakThemeId",
table: "KeycloakRealms");
migrationBuilder.DropColumn(
name: "KeycloakThemeId",
table: "KeycloakRealms");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,190 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddRegisteredPostgres : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "RegisteredPostgresDatabaseId",
table: "VaultSecrets",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "RegisteredPostgresDatabaseId",
table: "KeycloakComponentConfigs",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "RegisteredPostgresDatabaseId",
table: "DatabaseBindings",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "RegisteredPostgresInstances",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
KubernetesClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
Namespace = table.Column<string>(type: "TEXT", maxLength: 63, nullable: false),
ServiceName = table.Column<string>(type: "TEXT", maxLength: 253, nullable: false),
Port = table.Column<int>(type: "INTEGER", nullable: false),
AdminPodName = table.Column<string>(type: "TEXT", maxLength: 253, nullable: false),
AdminUsername = table.Column<string>(type: "TEXT", maxLength: 63, nullable: false),
Notes = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RegisteredPostgresInstances", x => x.Id);
table.ForeignKey(
name: "FK_RegisteredPostgresInstances_KubernetesClusters_KubernetesClusterId",
column: x => x.KubernetesClusterId,
principalTable: "KubernetesClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RegisteredPostgresInstances_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "RegisteredPostgresDatabases",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
RegisteredPostgresInstanceId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 63, nullable: false),
Owner = table.Column<string>(type: "TEXT", maxLength: 63, nullable: false),
Status = table.Column<int>(type: "INTEGER", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RegisteredPostgresDatabases", x => x.Id);
table.ForeignKey(
name: "FK_RegisteredPostgresDatabases_RegisteredPostgresInstances_RegisteredPostgresInstanceId",
column: x => x.RegisteredPostgresInstanceId,
principalTable: "RegisteredPostgresInstances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_RegisteredPostgresDatabaseId",
table: "VaultSecrets",
column: "RegisteredPostgresDatabaseId");
migrationBuilder.CreateIndex(
name: "IX_KeycloakComponentConfigs_RegisteredPostgresDatabaseId",
table: "KeycloakComponentConfigs",
column: "RegisteredPostgresDatabaseId");
migrationBuilder.CreateIndex(
name: "IX_DatabaseBindings_RegisteredPostgresDatabaseId",
table: "DatabaseBindings",
column: "RegisteredPostgresDatabaseId");
migrationBuilder.CreateIndex(
name: "IX_RegisteredPostgresDatabases_RegisteredPostgresInstanceId_Name",
table: "RegisteredPostgresDatabases",
columns: new[] { "RegisteredPostgresInstanceId", "Name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_RegisteredPostgresInstances_KubernetesClusterId",
table: "RegisteredPostgresInstances",
column: "KubernetesClusterId");
migrationBuilder.CreateIndex(
name: "IX_RegisteredPostgresInstances_TenantId_Name",
table: "RegisteredPostgresInstances",
columns: new[] { "TenantId", "Name" },
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_DatabaseBindings_RegisteredPostgresDatabases_RegisteredPostgresDatabaseId",
table: "DatabaseBindings",
column: "RegisteredPostgresDatabaseId",
principalTable: "RegisteredPostgresDatabases",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_KeycloakComponentConfigs_RegisteredPostgresDatabases_RegisteredPostgresDatabaseId",
table: "KeycloakComponentConfigs",
column: "RegisteredPostgresDatabaseId",
principalTable: "RegisteredPostgresDatabases",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_VaultSecrets_RegisteredPostgresDatabases_RegisteredPostgresDatabaseId",
table: "VaultSecrets",
column: "RegisteredPostgresDatabaseId",
principalTable: "RegisteredPostgresDatabases",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_DatabaseBindings_RegisteredPostgresDatabases_RegisteredPostgresDatabaseId",
table: "DatabaseBindings");
migrationBuilder.DropForeignKey(
name: "FK_KeycloakComponentConfigs_RegisteredPostgresDatabases_RegisteredPostgresDatabaseId",
table: "KeycloakComponentConfigs");
migrationBuilder.DropForeignKey(
name: "FK_VaultSecrets_RegisteredPostgresDatabases_RegisteredPostgresDatabaseId",
table: "VaultSecrets");
migrationBuilder.DropTable(
name: "RegisteredPostgresDatabases");
migrationBuilder.DropTable(
name: "RegisteredPostgresInstances");
migrationBuilder.DropIndex(
name: "IX_VaultSecrets_RegisteredPostgresDatabaseId",
table: "VaultSecrets");
migrationBuilder.DropIndex(
name: "IX_KeycloakComponentConfigs_RegisteredPostgresDatabaseId",
table: "KeycloakComponentConfigs");
migrationBuilder.DropIndex(
name: "IX_DatabaseBindings_RegisteredPostgresDatabaseId",
table: "DatabaseBindings");
migrationBuilder.DropColumn(
name: "RegisteredPostgresDatabaseId",
table: "VaultSecrets");
migrationBuilder.DropColumn(
name: "RegisteredPostgresDatabaseId",
table: "KeycloakComponentConfigs");
migrationBuilder.DropColumn(
name: "RegisteredPostgresDatabaseId",
table: "DatabaseBindings");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,60 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddRegisteredPostgresDump : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "RegisteredPostgresDumps",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
RegisteredPostgresDatabaseId = table.Column<Guid>(type: "TEXT", nullable: false),
StorageLinkId = table.Column<Guid>(type: "TEXT", nullable: false),
S3Key = table.Column<string>(type: "TEXT", maxLength: 1024, nullable: false),
SizeBytes = table.Column<long>(type: "INTEGER", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RegisteredPostgresDumps", x => x.Id);
table.ForeignKey(
name: "FK_RegisteredPostgresDumps_RegisteredPostgresDatabases_RegisteredPostgresDatabaseId",
column: x => x.RegisteredPostgresDatabaseId,
principalTable: "RegisteredPostgresDatabases",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RegisteredPostgresDumps_StorageLinks_StorageLinkId",
column: x => x.StorageLinkId,
principalTable: "StorageLinks",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_RegisteredPostgresDumps_RegisteredPostgresDatabaseId",
table: "RegisteredPostgresDumps",
column: "RegisteredPostgresDatabaseId");
migrationBuilder.CreateIndex(
name: "IX_RegisteredPostgresDumps_StorageLinkId",
table: "RegisteredPostgresDumps",
column: "StorageLinkId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RegisteredPostgresDumps");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddCnpgClusterVaultSecret : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "CnpgClusterId",
table: "VaultSecrets",
type: "TEXT",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_CnpgClusterId",
table: "VaultSecrets",
column: "CnpgClusterId");
migrationBuilder.AddForeignKey(
name: "FK_VaultSecrets_CnpgClusters_CnpgClusterId",
table: "VaultSecrets",
column: "CnpgClusterId",
principalTable: "CnpgClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_VaultSecrets_CnpgClusters_CnpgClusterId",
table: "VaultSecrets");
migrationBuilder.DropIndex(
name: "IX_VaultSecrets_CnpgClusterId",
table: "VaultSecrets");
migrationBuilder.DropColumn(
name: "CnpgClusterId",
table: "VaultSecrets");
}
}
}

View File

@@ -0,0 +1,61 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class KeycloakBackupStorageLinkNullable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_KeycloakBackups_StorageLinks_StorageLinkId",
table: "KeycloakBackups");
migrationBuilder.AlterColumn<Guid>(
name: "StorageLinkId",
table: "KeycloakBackups",
type: "TEXT",
nullable: true,
oldClrType: typeof(Guid),
oldType: "TEXT");
migrationBuilder.AddForeignKey(
name: "FK_KeycloakBackups_StorageLinks_StorageLinkId",
table: "KeycloakBackups",
column: "StorageLinkId",
principalTable: "StorageLinks",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_KeycloakBackups_StorageLinks_StorageLinkId",
table: "KeycloakBackups");
migrationBuilder.AlterColumn<Guid>(
name: "StorageLinkId",
table: "KeycloakBackups",
type: "TEXT",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "TEXT",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_KeycloakBackups_StorageLinks_StorageLinkId",
table: "KeycloakBackups",
column: "StorageLinkId",
principalTable: "StorageLinks",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,84 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddHarborComponentConfig : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "HarborComponentConfigs",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
ClusterComponentId = table.Column<Guid>(type: "TEXT", nullable: false),
CnpgDatabaseId = table.Column<Guid>(type: "TEXT", nullable: true),
StorageLinkId = table.Column<Guid>(type: "TEXT", nullable: true),
AdminUsername = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
RegistryUrl = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_HarborComponentConfigs", x => x.Id);
table.ForeignKey(
name: "FK_HarborComponentConfigs_ClusterComponents_ClusterComponentId",
column: x => x.ClusterComponentId,
principalTable: "ClusterComponents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_HarborComponentConfigs_CnpgDatabases_CnpgDatabaseId",
column: x => x.CnpgDatabaseId,
principalTable: "CnpgDatabases",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_HarborComponentConfigs_StorageLinks_StorageLinkId",
column: x => x.StorageLinkId,
principalTable: "StorageLinks",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_HarborComponentConfigs_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_HarborComponentConfigs_ClusterComponentId",
table: "HarborComponentConfigs",
column: "ClusterComponentId");
migrationBuilder.CreateIndex(
name: "IX_HarborComponentConfigs_CnpgDatabaseId",
table: "HarborComponentConfigs",
column: "CnpgDatabaseId");
migrationBuilder.CreateIndex(
name: "IX_HarborComponentConfigs_StorageLinkId",
table: "HarborComponentConfigs",
column: "StorageLinkId");
migrationBuilder.CreateIndex(
name: "IX_HarborComponentConfigs_TenantId",
table: "HarborComponentConfigs",
column: "TenantId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "HarborComponentConfigs");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddCnpgMaxBackups : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "MaxBackups",
table: "CnpgClusters",
type: "INTEGER",
nullable: false,
defaultValue: 20);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MaxBackups",
table: "CnpgClusters");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class FixCnpgMaxBackupsDefault : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// Backfill rows that got MaxBackups=0 from the initial migration which
// was generated with defaultValue:0 instead of defaultValue:20.
migrationBuilder.Sql(
"UPDATE \"CnpgClusters\" SET \"MaxBackups\" = 20 WHERE \"MaxBackups\" = 0");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
// Data migrations cannot be cleanly reversed.
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddMongoMaxBackups : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "MaxBackups",
table: "MongoClusters",
type: "INTEGER",
nullable: false,
defaultValue: 20);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MaxBackups",
table: "MongoClusters");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class FixMongoMaxBackupsDefault : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(
"UPDATE \"MongoClusters\" SET \"MaxBackups\" = 20 WHERE \"MaxBackups\" = 0");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddDockerRegistryCredential : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DockerRegistryCredentials",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
VaultId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
RegistryType = table.Column<int>(type: "INTEGER", nullable: false),
Server = table.Column<string>(type: "TEXT", maxLength: 500, nullable: false),
Username = table.Column<string>(type: "TEXT", maxLength: 300, nullable: false),
EncryptedPassword = table.Column<byte[]>(type: "BLOB", nullable: false),
PasswordNonce = table.Column<byte[]>(type: "BLOB", nullable: false),
Email = table.Column<string>(type: "TEXT", maxLength: 254, nullable: true),
AppId = table.Column<Guid>(type: "TEXT", nullable: true),
KubernetesClusterId = table.Column<Guid>(type: "TEXT", nullable: true),
KubernetesSecretName = table.Column<string>(type: "TEXT", maxLength: 253, nullable: true),
KubernetesNamespace = table.Column<string>(type: "TEXT", maxLength: 63, nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DockerRegistryCredentials", x => x.Id);
table.ForeignKey(
name: "FK_DockerRegistryCredentials_Apps_AppId",
column: x => x.AppId,
principalTable: "Apps",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DockerRegistryCredentials_KubernetesClusters_KubernetesClusterId",
column: x => x.KubernetesClusterId,
principalTable: "KubernetesClusters",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_DockerRegistryCredentials_SecretVaults_VaultId",
column: x => x.VaultId,
principalTable: "SecretVaults",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_DockerRegistryCredentials_AppId",
table: "DockerRegistryCredentials",
column: "AppId");
migrationBuilder.CreateIndex(
name: "IX_DockerRegistryCredentials_KubernetesClusterId",
table: "DockerRegistryCredentials",
column: "KubernetesClusterId");
migrationBuilder.CreateIndex(
name: "IX_DockerRegistryCredentials_VaultId",
table: "DockerRegistryCredentials",
column: "VaultId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DockerRegistryCredentials");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddAppSecretClusterId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "KubernetesClusterId",
table: "VaultSecrets",
type: "TEXT",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_KubernetesClusterId",
table: "VaultSecrets",
column: "KubernetesClusterId");
migrationBuilder.AddForeignKey(
name: "FK_VaultSecrets_KubernetesClusters_KubernetesClusterId",
table: "VaultSecrets",
column: "KubernetesClusterId",
principalTable: "KubernetesClusters",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_VaultSecrets_KubernetesClusters_KubernetesClusterId",
table: "VaultSecrets");
migrationBuilder.DropIndex(
name: "IX_VaultSecrets_KubernetesClusterId",
table: "VaultSecrets");
migrationBuilder.DropColumn(
name: "KubernetesClusterId",
table: "VaultSecrets");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,86 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddAuditEventsAndRouteHealth : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsReachable",
table: "ExternalRoutes",
type: "INTEGER",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "LastHealthCheckAt",
table: "ExternalRoutes",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "LastStatusCode",
table: "ExternalRoutes",
type: "INTEGER",
nullable: true);
migrationBuilder.CreateTable(
name: "AuditEvents",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
DeploymentId = table.Column<Guid>(type: "TEXT", nullable: true),
PerformedBy = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
Action = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
ResourceKind = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
ResourceName = table.Column<string>(type: "TEXT", maxLength: 253, nullable: true),
Details = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: true),
OccurredAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AuditEvents", x => x.Id);
table.ForeignKey(
name: "FK_AuditEvents_AppDeployments_DeploymentId",
column: x => x.DeploymentId,
principalTable: "AppDeployments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AuditEvents_DeploymentId",
table: "AuditEvents",
column: "DeploymentId");
migrationBuilder.CreateIndex(
name: "IX_AuditEvents_OccurredAt",
table: "AuditEvents",
column: "OccurredAt");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AuditEvents");
migrationBuilder.DropColumn(
name: "IsReachable",
table: "ExternalRoutes");
migrationBuilder.DropColumn(
name: "LastHealthCheckAt",
table: "ExternalRoutes");
migrationBuilder.DropColumn(
name: "LastStatusCode",
table: "ExternalRoutes");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,72 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddHarborProject : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "HarborProjects",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
HarborComponentConfigId = table.Column<Guid>(type: "TEXT", nullable: false),
ProjectName = table.Column<string>(type: "TEXT", maxLength: 255, nullable: false),
LinkedAppId = table.Column<Guid>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_HarborProjects", x => x.Id);
table.ForeignKey(
name: "FK_HarborProjects_Apps_LinkedAppId",
column: x => x.LinkedAppId,
principalTable: "Apps",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_HarborProjects_HarborComponentConfigs_HarborComponentConfigId",
column: x => x.HarborComponentConfigId,
principalTable: "HarborComponentConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_HarborProjects_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_HarborProjects_HarborComponentConfigId_ProjectName",
table: "HarborProjects",
columns: new[] { "HarborComponentConfigId", "ProjectName" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_HarborProjects_LinkedAppId",
table: "HarborProjects",
column: "LinkedAppId");
migrationBuilder.CreateIndex(
name: "IX_HarborProjects_TenantId",
table: "HarborProjects",
column: "TenantId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "HarborProjects");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,127 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddRabbitMQ : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "RabbitMQClusters",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
KubernetesClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 63, nullable: false),
Namespace = table.Column<string>(type: "TEXT", maxLength: 63, nullable: false),
RabbitMQVersion = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
Replicas = table.Column<int>(type: "INTEGER", nullable: false),
StorageSize = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
StorageClass = table.Column<string>(type: "TEXT", maxLength: 63, nullable: true),
StorageLinkId = table.Column<Guid>(type: "TEXT", nullable: true),
BackupSchedule = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
MaxBackups = table.Column<int>(type: "INTEGER", nullable: false, defaultValue: 10),
Status = table.Column<int>(type: "INTEGER", nullable: false),
LastError = table.Column<string>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RabbitMQClusters", x => x.Id);
table.ForeignKey(
name: "FK_RabbitMQClusters_KubernetesClusters_KubernetesClusterId",
column: x => x.KubernetesClusterId,
principalTable: "KubernetesClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RabbitMQClusters_StorageLinks_StorageLinkId",
column: x => x.StorageLinkId,
principalTable: "StorageLinks",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_RabbitMQClusters_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "RabbitMQBackups",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
RabbitMQClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
StorageLinkId = table.Column<Guid>(type: "TEXT", nullable: true),
ObjectKey = table.Column<string>(type: "TEXT", maxLength: 1024, nullable: false),
ClusterName = table.Column<string>(type: "TEXT", maxLength: 63, nullable: false),
SizeBytes = table.Column<long>(type: "INTEGER", nullable: false),
Status = table.Column<int>(type: "INTEGER", nullable: false),
LastError = table.Column<string>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
CompletedAt = table.Column<DateTime>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RabbitMQBackups", x => x.Id);
table.ForeignKey(
name: "FK_RabbitMQBackups_RabbitMQClusters_RabbitMQClusterId",
column: x => x.RabbitMQClusterId,
principalTable: "RabbitMQClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RabbitMQBackups_StorageLinks_StorageLinkId",
column: x => x.StorageLinkId,
principalTable: "StorageLinks",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateIndex(
name: "IX_RabbitMQBackups_RabbitMQClusterId",
table: "RabbitMQBackups",
column: "RabbitMQClusterId");
migrationBuilder.CreateIndex(
name: "IX_RabbitMQBackups_StorageLinkId",
table: "RabbitMQBackups",
column: "StorageLinkId");
migrationBuilder.CreateIndex(
name: "IX_RabbitMQClusters_KubernetesClusterId_Name_Namespace",
table: "RabbitMQClusters",
columns: new[] { "KubernetesClusterId", "Name", "Namespace" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_RabbitMQClusters_StorageLinkId",
table: "RabbitMQClusters",
column: "StorageLinkId");
migrationBuilder.CreateIndex(
name: "IX_RabbitMQClusters_TenantId",
table: "RabbitMQClusters",
column: "TenantId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RabbitMQBackups");
migrationBuilder.DropTable(
name: "RabbitMQClusters");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddRabbitMQCredentialVaultSync : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "RabbitMQClusterId",
table: "VaultSecrets",
type: "TEXT",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_RabbitMQClusterId",
table: "VaultSecrets",
column: "RabbitMQClusterId");
migrationBuilder.AddForeignKey(
name: "FK_VaultSecrets_RabbitMQClusters_RabbitMQClusterId",
table: "VaultSecrets",
column: "RabbitMQClusterId",
principalTable: "RabbitMQClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_VaultSecrets_RabbitMQClusters_RabbitMQClusterId",
table: "VaultSecrets");
migrationBuilder.DropIndex(
name: "IX_VaultSecrets_RabbitMQClusterId",
table: "VaultSecrets");
migrationBuilder.DropColumn(
name: "RabbitMQClusterId",
table: "VaultSecrets");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddMongoClusterIsExternal : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsExternal",
table: "MongoClusters",
type: "INTEGER",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsExternal",
table: "MongoClusters");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,205 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddMonitoringAndAlerting : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AlertIncidents",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
ClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
Fingerprint = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
AlertName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
Severity = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
Summary = table.Column<string>(type: "TEXT", maxLength: 500, nullable: false),
Description = table.Column<string>(type: "TEXT", maxLength: 2000, nullable: false),
LabelsJson = table.Column<string>(type: "TEXT", nullable: false),
StartsAt = table.Column<DateTime>(type: "TEXT", nullable: false),
EndsAt = table.Column<DateTime>(type: "TEXT", nullable: true),
Status = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
AcknowledgedBy = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
AcknowledgedAt = table.Column<DateTime>(type: "TEXT", nullable: true),
ResolvedAt = table.Column<DateTime>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AlertIncidents", x => x.Id);
table.ForeignKey(
name: "FK_AlertIncidents_KubernetesClusters_ClusterId",
column: x => x.ClusterId,
principalTable: "KubernetesClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DeploymentHealthSnapshots",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
DeploymentId = table.Column<Guid>(type: "TEXT", nullable: false),
HealthStatus = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
SyncStatus = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
ReadyReplicas = table.Column<int>(type: "INTEGER", nullable: true),
TotalReplicas = table.Column<int>(type: "INTEGER", nullable: true),
SnapshotAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DeploymentHealthSnapshots", x => x.Id);
table.ForeignKey(
name: "FK_DeploymentHealthSnapshots_AppDeployments_DeploymentId",
column: x => x.DeploymentId,
principalTable: "AppDeployments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "NotificationChannels",
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),
Type = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
ConfigurationJson = table.Column<string>(type: "TEXT", nullable: false),
IsEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
SeverityFilter = table.Column<string>(type: "TEXT", maxLength: 30, nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_NotificationChannels", x => x.Id);
table.ForeignKey(
name: "FK_NotificationChannels_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IncidentNotes",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
IncidentId = table.Column<Guid>(type: "TEXT", nullable: false),
Author = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
Content = table.Column<string>(type: "TEXT", maxLength: 2000, nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IncidentNotes", x => x.Id);
table.ForeignKey(
name: "FK_IncidentNotes_AlertIncidents_IncidentId",
column: x => x.IncidentId,
principalTable: "AlertIncidents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "NotificationDeliveries",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
IncidentId = table.Column<Guid>(type: "TEXT", nullable: false),
ChannelId = table.Column<Guid>(type: "TEXT", nullable: false),
IsFiring = table.Column<bool>(type: "INTEGER", nullable: false),
SentAt = table.Column<DateTime>(type: "TEXT", nullable: false),
Success = table.Column<bool>(type: "INTEGER", nullable: false),
Error = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_NotificationDeliveries", x => x.Id);
table.ForeignKey(
name: "FK_NotificationDeliveries_AlertIncidents_IncidentId",
column: x => x.IncidentId,
principalTable: "AlertIncidents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_NotificationDeliveries_NotificationChannels_ChannelId",
column: x => x.ChannelId,
principalTable: "NotificationChannels",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AlertIncidents_ClusterId_Fingerprint",
table: "AlertIncidents",
columns: new[] { "ClusterId", "Fingerprint" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AlertIncidents_StartsAt",
table: "AlertIncidents",
column: "StartsAt");
migrationBuilder.CreateIndex(
name: "IX_AlertIncidents_Status",
table: "AlertIncidents",
column: "Status");
migrationBuilder.CreateIndex(
name: "IX_DeploymentHealthSnapshots_DeploymentId_SnapshotAt",
table: "DeploymentHealthSnapshots",
columns: new[] { "DeploymentId", "SnapshotAt" });
migrationBuilder.CreateIndex(
name: "IX_IncidentNotes_IncidentId",
table: "IncidentNotes",
column: "IncidentId");
migrationBuilder.CreateIndex(
name: "IX_NotificationChannels_TenantId_Name",
table: "NotificationChannels",
columns: new[] { "TenantId", "Name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_NotificationDeliveries_ChannelId",
table: "NotificationDeliveries",
column: "ChannelId");
migrationBuilder.CreateIndex(
name: "IX_NotificationDeliveries_IncidentId_ChannelId_IsFiring",
table: "NotificationDeliveries",
columns: new[] { "IncidentId", "ChannelId", "IsFiring" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DeploymentHealthSnapshots");
migrationBuilder.DropTable(
name: "IncidentNotes");
migrationBuilder.DropTable(
name: "NotificationDeliveries");
migrationBuilder.DropTable(
name: "AlertIncidents");
migrationBuilder.DropTable(
name: "NotificationChannels");
}
}
}

View File

@@ -0,0 +1,152 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddMaintenanceWindowsSlaTargetsRouteHistory : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ExternalRouteHealthHistories",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
RouteId = table.Column<Guid>(type: "TEXT", nullable: false),
IsReachable = table.Column<bool>(type: "INTEGER", nullable: false),
StatusCode = table.Column<int>(type: "INTEGER", nullable: true),
ResponseMs = table.Column<int>(type: "INTEGER", nullable: true),
CheckedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ExternalRouteHealthHistories", x => x.Id);
table.ForeignKey(
name: "FK_ExternalRouteHealthHistories_ExternalRoutes_RouteId",
column: x => x.RouteId,
principalTable: "ExternalRoutes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "MaintenanceWindows",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
ClusterId = table.Column<Guid>(type: "TEXT", nullable: true),
Title = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
Description = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: true),
StartsAt = table.Column<DateTime>(type: "TEXT", nullable: false),
EndsAt = table.Column<DateTime>(type: "TEXT", nullable: false),
CreatedBy = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_MaintenanceWindows", x => x.Id);
table.ForeignKey(
name: "FK_MaintenanceWindows_KubernetesClusters_ClusterId",
column: x => x.ClusterId,
principalTable: "KubernetesClusters",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_MaintenanceWindows_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "SlaTargets",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
CustomerId = table.Column<Guid>(type: "TEXT", nullable: true),
AppId = table.Column<Guid>(type: "TEXT", nullable: true),
TargetPercent = table.Column<double>(type: "REAL", nullable: false),
MeasurementWindowDays = table.Column<int>(type: "INTEGER", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SlaTargets", x => x.Id);
table.ForeignKey(
name: "FK_SlaTargets_Apps_AppId",
column: x => x.AppId,
principalTable: "Apps",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SlaTargets_Customers_CustomerId",
column: x => x.CustomerId,
principalTable: "Customers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SlaTargets_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ExternalRouteHealthHistories_RouteId_CheckedAt",
table: "ExternalRouteHealthHistories",
columns: new[] { "RouteId", "CheckedAt" });
migrationBuilder.CreateIndex(
name: "IX_MaintenanceWindows_ClusterId",
table: "MaintenanceWindows",
column: "ClusterId");
migrationBuilder.CreateIndex(
name: "IX_MaintenanceWindows_StartsAt",
table: "MaintenanceWindows",
column: "StartsAt");
migrationBuilder.CreateIndex(
name: "IX_MaintenanceWindows_TenantId_StartsAt",
table: "MaintenanceWindows",
columns: new[] { "TenantId", "StartsAt" });
migrationBuilder.CreateIndex(
name: "IX_SlaTargets_AppId",
table: "SlaTargets",
column: "AppId");
migrationBuilder.CreateIndex(
name: "IX_SlaTargets_CustomerId",
table: "SlaTargets",
column: "CustomerId");
migrationBuilder.CreateIndex(
name: "IX_SlaTargets_TenantId_CustomerId_AppId",
table: "SlaTargets",
columns: new[] { "TenantId", "CustomerId", "AppId" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ExternalRouteHealthHistories");
migrationBuilder.DropTable(
name: "MaintenanceWindows");
migrationBuilder.DropTable(
name: "SlaTargets");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddMessagingBinding : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "MessagingBindings",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
RabbitMQClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
AppDeploymentId = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
Vhost = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
QueueName = table.Column<string>(type: "TEXT", maxLength: 255, nullable: true),
ExchangeName = table.Column<string>(type: "TEXT", maxLength: 255, nullable: true),
KubernetesSecretName = table.Column<string>(type: "TEXT", maxLength: 253, nullable: false),
SyncEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
LastSyncedAt = table.Column<DateTime>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_MessagingBindings", x => x.Id);
table.ForeignKey(
name: "FK_MessagingBindings_AppDeployments_AppDeploymentId",
column: x => x.AppDeploymentId,
principalTable: "AppDeployments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MessagingBindings_RabbitMQClusters_RabbitMQClusterId",
column: x => x.RabbitMQClusterId,
principalTable: "RabbitMQClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_MessagingBindings_AppDeploymentId",
table: "MessagingBindings",
column: "AppDeploymentId");
migrationBuilder.CreateIndex(
name: "IX_MessagingBindings_RabbitMQClusterId",
table: "MessagingBindings",
column: "RabbitMQClusterId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "MessagingBindings");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddMongoClusterExternalUri : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ExternalUri",
table: "MongoClusters",
type: "TEXT",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ExternalUri",
table: "MongoClusters");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,176 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddVpnTunnels : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "VpnRemoteEndpointId",
table: "VaultSecrets",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "VpnTunnels",
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", nullable: true),
TunnelType = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
Status = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
IkeVersion = table.Column<int>(type: "INTEGER", nullable: false),
IkeProposal = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
EspProposal = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
DpdDelay = table.Column<int>(type: "INTEGER", nullable: false),
DpdTimeout = table.Column<int>(type: "INTEGER", nullable: false),
LastStatusCheckAt = table.Column<DateTime>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_VpnTunnels", x => x.Id);
table.ForeignKey(
name: "FK_VpnTunnels_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "VpnLocalEndpoints",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
VpnTunnelId = table.Column<Guid>(type: "TEXT", nullable: false),
ClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
ComponentId = table.Column<Guid>(type: "TEXT", nullable: true),
Subnets = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: false),
PublicIp = table.Column<string>(type: "TEXT", maxLength: 45, nullable: true),
Role = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
Status = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_VpnLocalEndpoints", x => x.Id);
table.ForeignKey(
name: "FK_VpnLocalEndpoints_ClusterComponents_ComponentId",
column: x => x.ComponentId,
principalTable: "ClusterComponents",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_VpnLocalEndpoints_KubernetesClusters_ClusterId",
column: x => x.ClusterId,
principalTable: "KubernetesClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_VpnLocalEndpoints_VpnTunnels_VpnTunnelId",
column: x => x.VpnTunnelId,
principalTable: "VpnTunnels",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "VpnRemoteEndpoints",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
VpnTunnelId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
PublicIp = table.Column<string>(type: "TEXT", maxLength: 45, nullable: false),
Subnets = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: false),
AuthMode = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
Status = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
LastSeenAt = table.Column<DateTime>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_VpnRemoteEndpoints", x => x.Id);
table.ForeignKey(
name: "FK_VpnRemoteEndpoints_VpnTunnels_VpnTunnelId",
column: x => x.VpnTunnelId,
principalTable: "VpnTunnels",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_VpnRemoteEndpointId",
table: "VaultSecrets",
column: "VpnRemoteEndpointId");
migrationBuilder.CreateIndex(
name: "IX_VpnLocalEndpoints_ClusterId",
table: "VpnLocalEndpoints",
column: "ClusterId");
migrationBuilder.CreateIndex(
name: "IX_VpnLocalEndpoints_ComponentId",
table: "VpnLocalEndpoints",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_VpnLocalEndpoints_VpnTunnelId",
table: "VpnLocalEndpoints",
column: "VpnTunnelId");
migrationBuilder.CreateIndex(
name: "IX_VpnRemoteEndpoints_VpnTunnelId",
table: "VpnRemoteEndpoints",
column: "VpnTunnelId");
migrationBuilder.CreateIndex(
name: "IX_VpnTunnels_TenantId_Name",
table: "VpnTunnels",
columns: new[] { "TenantId", "Name" },
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_VaultSecrets_VpnRemoteEndpoints_VpnRemoteEndpointId",
table: "VaultSecrets",
column: "VpnRemoteEndpointId",
principalTable: "VpnRemoteEndpoints",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_VaultSecrets_VpnRemoteEndpoints_VpnRemoteEndpointId",
table: "VaultSecrets");
migrationBuilder.DropTable(
name: "VpnLocalEndpoints");
migrationBuilder.DropTable(
name: "VpnRemoteEndpoints");
migrationBuilder.DropTable(
name: "VpnTunnels");
migrationBuilder.DropIndex(
name: "IX_VaultSecrets_VpnRemoteEndpointId",
table: "VaultSecrets");
migrationBuilder.DropColumn(
name: "VpnRemoteEndpointId",
table: "VaultSecrets");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,62 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddVpnLifetimeAndIdentity : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ChildLifetime",
table: "VpnTunnels",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "IkeLifetime",
table: "VpnTunnels",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "LocalId",
table: "VpnRemoteEndpoints",
type: "TEXT",
maxLength: 500,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "RemoteId",
table: "VpnRemoteEndpoints",
type: "TEXT",
maxLength: 500,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ChildLifetime",
table: "VpnTunnels");
migrationBuilder.DropColumn(
name: "IkeLifetime",
table: "VpnTunnels");
migrationBuilder.DropColumn(
name: "LocalId",
table: "VpnRemoteEndpoints");
migrationBuilder.DropColumn(
name: "RemoteId",
table: "VpnRemoteEndpoints");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,99 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddRedisCluster : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "RedisClusterId",
table: "VaultSecrets",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "RedisClusters",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
KubernetesClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 63, nullable: false),
Namespace = table.Column<string>(type: "TEXT", maxLength: 63, nullable: false),
ClusterSize = table.Column<int>(type: "INTEGER", nullable: false),
RedisVersion = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
StorageSize = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
StorageClass = table.Column<string>(type: "TEXT", maxLength: 63, nullable: true),
PersistenceEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
Status = table.Column<int>(type: "INTEGER", nullable: false),
LastError = table.Column<string>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RedisClusters", x => x.Id);
table.ForeignKey(
name: "FK_RedisClusters_KubernetesClusters_KubernetesClusterId",
column: x => x.KubernetesClusterId,
principalTable: "KubernetesClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RedisClusters_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_RedisClusterId",
table: "VaultSecrets",
column: "RedisClusterId");
migrationBuilder.CreateIndex(
name: "IX_RedisClusters_KubernetesClusterId_Name_Namespace",
table: "RedisClusters",
columns: new[] { "KubernetesClusterId", "Name", "Namespace" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_RedisClusters_TenantId",
table: "RedisClusters",
column: "TenantId");
migrationBuilder.AddForeignKey(
name: "FK_VaultSecrets_RedisClusters_RedisClusterId",
table: "VaultSecrets",
column: "RedisClusterId",
principalTable: "RedisClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_VaultSecrets_RedisClusters_RedisClusterId",
table: "VaultSecrets");
migrationBuilder.DropTable(
name: "RedisClusters");
migrationBuilder.DropIndex(
name: "IX_VaultSecrets_RedisClusterId",
table: "VaultSecrets");
migrationBuilder.DropColumn(
name: "RedisClusterId",
table: "VaultSecrets");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,62 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddCacheBinding : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CacheBindings",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
RedisClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
AppDeploymentId = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
KubernetesSecretName = table.Column<string>(type: "TEXT", maxLength: 253, nullable: false),
SyncEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
LastSyncedAt = table.Column<DateTime>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CacheBindings", x => x.Id);
table.ForeignKey(
name: "FK_CacheBindings_AppDeployments_AppDeploymentId",
column: x => x.AppDeploymentId,
principalTable: "AppDeployments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CacheBindings_RedisClusters_RedisClusterId",
column: x => x.RedisClusterId,
principalTable: "RedisClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CacheBindings_AppDeploymentId",
table: "CacheBindings",
column: "AppDeploymentId");
migrationBuilder.CreateIndex(
name: "IX_CacheBindings_RedisClusterId",
table: "CacheBindings",
column: "RedisClusterId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CacheBindings");
}
}
}

View File

@@ -0,0 +1,51 @@
using EntKube.Web.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260602200000_AddMongoClusterResources")]
public partial class AddMongoClusterResources : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "CpuRequest",
table: "MongoClusters",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CpuLimit",
table: "MongoClusters",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "MemoryRequest",
table: "MongoClusters",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "MemoryLimit",
table: "MongoClusters",
type: "TEXT",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(name: "CpuRequest", table: "MongoClusters");
migrationBuilder.DropColumn(name: "CpuLimit", table: "MongoClusters");
migrationBuilder.DropColumn(name: "MemoryRequest", table: "MongoClusters");
migrationBuilder.DropColumn(name: "MemoryLimit", table: "MongoClusters");
}
}
}

View File

@@ -0,0 +1,33 @@
using EntKube.Web.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260603080000_AddCnpgClusterIsExternal")]
public partial class AddCnpgClusterIsExternal : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsExternal",
table: "CnpgClusters",
type: "INTEGER",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsExternal",
table: "CnpgClusters");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,251 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddGitSync : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "GitRepositoryId",
table: "VaultSecrets",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "SourceFile",
table: "DeploymentManifests",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "GitAutoSync",
table: "AppDeployments",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "GitLastSyncedAt",
table: "AppDeployments",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "GitLastSyncedCommit",
table: "AppDeployments",
type: "TEXT",
maxLength: 40,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "GitPath",
table: "AppDeployments",
type: "TEXT",
maxLength: 500,
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "GitRepositoryId",
table: "AppDeployments",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "GitRevision",
table: "AppDeployments",
type: "TEXT",
maxLength: 200,
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "ParentDeploymentId",
table: "AppDeployments",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "GitRepositories",
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),
Url = table.Column<string>(type: "TEXT", maxLength: 2000, nullable: false),
AuthType = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
Username = table.Column<string>(type: "TEXT", maxLength: 300, nullable: true),
DefaultBranch = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false, defaultValue: "main"),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GitRepositories", x => x.Id);
table.ForeignKey(
name: "FK_GitRepositories_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "GitKnownHosts",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
Hostname = table.Column<string>(type: "TEXT", maxLength: 253, nullable: false),
Fingerprint = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
KeyType = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
TrustedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
GitRepositoryId = table.Column<Guid>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_GitKnownHosts", x => x.Id);
table.ForeignKey(
name: "FK_GitKnownHosts_GitRepositories_GitRepositoryId",
column: x => x.GitRepositoryId,
principalTable: "GitRepositories",
principalColumn: "Id");
table.ForeignKey(
name: "FK_GitKnownHosts_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_GitRepositoryId",
table: "VaultSecrets",
column: "GitRepositoryId");
migrationBuilder.CreateIndex(
name: "IX_AppDeployments_GitRepositoryId",
table: "AppDeployments",
column: "GitRepositoryId");
migrationBuilder.CreateIndex(
name: "IX_AppDeployments_ParentDeploymentId",
table: "AppDeployments",
column: "ParentDeploymentId");
migrationBuilder.CreateIndex(
name: "IX_GitKnownHosts_GitRepositoryId",
table: "GitKnownHosts",
column: "GitRepositoryId");
migrationBuilder.CreateIndex(
name: "IX_GitKnownHosts_TenantId_Hostname",
table: "GitKnownHosts",
columns: new[] { "TenantId", "Hostname" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_GitRepositories_TenantId_Name",
table: "GitRepositories",
columns: new[] { "TenantId", "Name" },
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_AppDeployments_AppDeployments_ParentDeploymentId",
table: "AppDeployments",
column: "ParentDeploymentId",
principalTable: "AppDeployments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AppDeployments_GitRepositories_GitRepositoryId",
table: "AppDeployments",
column: "GitRepositoryId",
principalTable: "GitRepositories",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_VaultSecrets_GitRepositories_GitRepositoryId",
table: "VaultSecrets",
column: "GitRepositoryId",
principalTable: "GitRepositories",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AppDeployments_AppDeployments_ParentDeploymentId",
table: "AppDeployments");
migrationBuilder.DropForeignKey(
name: "FK_AppDeployments_GitRepositories_GitRepositoryId",
table: "AppDeployments");
migrationBuilder.DropForeignKey(
name: "FK_VaultSecrets_GitRepositories_GitRepositoryId",
table: "VaultSecrets");
migrationBuilder.DropTable(
name: "GitKnownHosts");
migrationBuilder.DropTable(
name: "GitRepositories");
migrationBuilder.DropIndex(
name: "IX_VaultSecrets_GitRepositoryId",
table: "VaultSecrets");
migrationBuilder.DropIndex(
name: "IX_AppDeployments_GitRepositoryId",
table: "AppDeployments");
migrationBuilder.DropIndex(
name: "IX_AppDeployments_ParentDeploymentId",
table: "AppDeployments");
migrationBuilder.DropColumn(
name: "GitRepositoryId",
table: "VaultSecrets");
migrationBuilder.DropColumn(
name: "SourceFile",
table: "DeploymentManifests");
migrationBuilder.DropColumn(
name: "GitAutoSync",
table: "AppDeployments");
migrationBuilder.DropColumn(
name: "GitLastSyncedAt",
table: "AppDeployments");
migrationBuilder.DropColumn(
name: "GitLastSyncedCommit",
table: "AppDeployments");
migrationBuilder.DropColumn(
name: "GitPath",
table: "AppDeployments");
migrationBuilder.DropColumn(
name: "GitRepositoryId",
table: "AppDeployments");
migrationBuilder.DropColumn(
name: "GitRevision",
table: "AppDeployments");
migrationBuilder.DropColumn(
name: "ParentDeploymentId",
table: "AppDeployments");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,153 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddAppGovernance : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Namespace",
table: "Apps",
type: "TEXT",
maxLength: 63,
nullable: true);
migrationBuilder.CreateTable(
name: "AppNetworkPolicies",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
AppId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 63, nullable: false),
PolicyType = table.Column<string>(type: "TEXT", maxLength: 30, nullable: false),
AllowFromNamespace = table.Column<string>(type: "TEXT", maxLength: 63, nullable: true),
CustomYaml = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AppNetworkPolicies", x => x.Id);
table.ForeignKey(
name: "FK_AppNetworkPolicies_Apps_AppId",
column: x => x.AppId,
principalTable: "Apps",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AppQuotas",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
AppId = table.Column<Guid>(type: "TEXT", nullable: false),
CpuRequest = table.Column<string>(type: "TEXT", maxLength: 20, nullable: true),
CpuLimit = table.Column<string>(type: "TEXT", maxLength: 20, nullable: true),
MemoryRequest = table.Column<string>(type: "TEXT", maxLength: 20, nullable: true),
MemoryLimit = table.Column<string>(type: "TEXT", maxLength: 20, nullable: true),
MaxPods = table.Column<int>(type: "INTEGER", nullable: true),
MaxPvcs = table.Column<int>(type: "INTEGER", nullable: true),
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppQuotas", x => x.Id);
table.ForeignKey(
name: "FK_AppQuotas_Apps_AppId",
column: x => x.AppId,
principalTable: "Apps",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AppRbacPolicies",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
AppId = table.Column<Guid>(type: "TEXT", nullable: false),
ServiceAccountName = table.Column<string>(type: "TEXT", maxLength: 63, nullable: false),
AutoMountToken = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppRbacPolicies", x => x.Id);
table.ForeignKey(
name: "FK_AppRbacPolicies_Apps_AppId",
column: x => x.AppId,
principalTable: "Apps",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AppRbacRules",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
AppRbacPolicyId = table.Column<Guid>(type: "TEXT", nullable: false),
ApiGroups = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
Resources = table.Column<string>(type: "TEXT", maxLength: 500, nullable: false),
Verbs = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppRbacRules", x => x.Id);
table.ForeignKey(
name: "FK_AppRbacRules_AppRbacPolicies_AppRbacPolicyId",
column: x => x.AppRbacPolicyId,
principalTable: "AppRbacPolicies",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AppNetworkPolicies_AppId_Name",
table: "AppNetworkPolicies",
columns: new[] { "AppId", "Name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AppQuotas_AppId",
table: "AppQuotas",
column: "AppId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AppRbacPolicies_AppId",
table: "AppRbacPolicies",
column: "AppId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AppRbacRules_AppRbacPolicyId",
table: "AppRbacRules",
column: "AppRbacPolicyId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AppNetworkPolicies");
migrationBuilder.DropTable(
name: "AppQuotas");
migrationBuilder.DropTable(
name: "AppRbacRules");
migrationBuilder.DropTable(
name: "AppRbacPolicies");
migrationBuilder.DropColumn(
name: "Namespace",
table: "Apps");
}
}
}