using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
///
public partial class AddDockerRegistryCredential : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DockerRegistryCredentials",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
VaultId = table.Column(type: "TEXT", nullable: false),
Name = table.Column(type: "TEXT", maxLength: 200, nullable: false),
RegistryType = table.Column(type: "INTEGER", nullable: false),
Server = table.Column(type: "TEXT", maxLength: 500, nullable: false),
Username = table.Column(type: "TEXT", maxLength: 300, nullable: false),
EncryptedPassword = table.Column(type: "BLOB", nullable: false),
PasswordNonce = table.Column(type: "BLOB", nullable: false),
Email = table.Column(type: "TEXT", maxLength: 254, nullable: true),
AppId = table.Column(type: "TEXT", nullable: true),
KubernetesClusterId = table.Column(type: "TEXT", nullable: true),
KubernetesSecretName = table.Column(type: "TEXT", maxLength: 253, nullable: true),
KubernetesNamespace = table.Column(type: "TEXT", maxLength: 63, nullable: true),
CreatedAt = table.Column(type: "TEXT", nullable: false),
UpdatedAt = table.Column(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");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DockerRegistryCredentials");
}
}
}