Mark subproject as dirty in CMKS - Infra

This commit is contained in:
Nils Blomgren
2026-05-18 08:37:09 +02:00
parent 328d494530
commit 8b94fb8826
635 changed files with 81145 additions and 100551 deletions

View File

@@ -0,0 +1,268 @@
// <auto-generated />
using System;
using EntKube.Web.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260516154156_CreateIdentitySchema")]
partial class CreateIdentitySchema
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.8");
modelBuilder.Entity("EntKube.Web.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,222 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class CreateIdentitySchema : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetUsers",
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false),
UserName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
Email = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "INTEGER", nullable: false),
PasswordHash = table.Column<string>(type: "TEXT", nullable: true),
SecurityStamp = table.Column<string>(type: "TEXT", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "TEXT", nullable: true),
PhoneNumber = table.Column<string>(type: "TEXT", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "INTEGER", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "TEXT", nullable: true),
LockoutEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
AccessFailedCount = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
RoleId = table.Column<string>(type: "TEXT", nullable: false),
ClaimType = table.Column<string>(type: "TEXT", nullable: true),
ClaimValue = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UserId = table.Column<string>(type: "TEXT", nullable: false),
ClaimType = table.Column<string>(type: "TEXT", nullable: true),
ClaimValue = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserLogins",
columns: table => new
{
LoginProvider = table.Column<string>(type: "TEXT", nullable: false),
ProviderKey = table.Column<string>(type: "TEXT", nullable: false),
ProviderDisplayName = table.Column<string>(type: "TEXT", nullable: true),
UserId = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
table.ForeignKey(
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column<string>(type: "TEXT", nullable: false),
RoleId = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column<string>(type: "TEXT", nullable: false),
LoginProvider = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Value = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId",
table: "AspNetUserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserLogins_UserId",
table: "AspNetUserLogins",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_RoleId",
table: "AspNetUserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "AspNetUsers",
column: "NormalizedUserName",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AspNetRoleClaims");
migrationBuilder.DropTable(
name: "AspNetUserClaims");
migrationBuilder.DropTable(
name: "AspNetUserLogins");
migrationBuilder.DropTable(
name: "AspNetUserRoles");
migrationBuilder.DropTable(
name: "AspNetUserTokens");
migrationBuilder.DropTable(
name: "AspNetRoles");
migrationBuilder.DropTable(
name: "AspNetUsers");
}
}
}

View File

@@ -0,0 +1,470 @@
// <auto-generated />
using System;
using EntKube.Web.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260516171915_AddTenantsAndGroups")]
partial class AddTenantsAndGroups
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.8");
modelBuilder.Entity("EntKube.Web.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Groups");
});
modelBuilder.Entity("EntKube.Web.Data.GroupMembership", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<Guid>("GroupId")
.HasColumnType("TEXT");
b.Property<DateTime>("JoinedAt")
.HasColumnType("TEXT");
b.HasKey("UserId", "GroupId");
b.HasIndex("GroupId");
b.ToTable("GroupMemberships");
});
modelBuilder.Entity("EntKube.Web.Data.Tenant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Tenants");
});
modelBuilder.Entity("EntKube.Web.Data.TenantMembership", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.Property<DateTime>("JoinedAt")
.HasColumnType("TEXT");
b.Property<Guid>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "TenantId");
b.HasIndex("RoleId");
b.HasIndex("TenantId");
b.ToTable("TenantMemberships");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("TenantRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Groups")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.GroupMembership", b =>
{
b.HasOne("EntKube.Web.Data.Group", "Group")
.WithMany("Memberships")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Group");
b.Navigation("User");
});
modelBuilder.Entity("EntKube.Web.Data.TenantMembership", b =>
{
b.HasOne("EntKube.Web.Data.TenantRole", "Role")
.WithMany("Memberships")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Memberships")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
b.Navigation("Tenant");
b.Navigation("User");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Roles")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.Navigation("Memberships");
});
modelBuilder.Entity("EntKube.Web.Data.Tenant", b =>
{
b.Navigation("Groups");
b.Navigation("Memberships");
b.Navigation("Roles");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.Navigation("Memberships");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,177 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddTenantsAndGroups : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Tenants",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
Slug = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tenants", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Groups",
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),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Groups", x => x.Id);
table.ForeignKey(
name: "FK_Groups_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TenantRoles",
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: 100, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TenantRoles", x => x.Id);
table.ForeignKey(
name: "FK_TenantRoles_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "GroupMemberships",
columns: table => new
{
UserId = table.Column<string>(type: "TEXT", nullable: false),
GroupId = table.Column<Guid>(type: "TEXT", nullable: false),
JoinedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GroupMemberships", x => new { x.UserId, x.GroupId });
table.ForeignKey(
name: "FK_GroupMemberships_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GroupMemberships_Groups_GroupId",
column: x => x.GroupId,
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TenantMemberships",
columns: table => new
{
UserId = table.Column<string>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
RoleId = table.Column<Guid>(type: "TEXT", nullable: false),
JoinedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TenantMemberships", x => new { x.UserId, x.TenantId });
table.ForeignKey(
name: "FK_TenantMemberships_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TenantMemberships_TenantRoles_RoleId",
column: x => x.RoleId,
principalTable: "TenantRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_TenantMemberships_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_GroupMemberships_GroupId",
table: "GroupMemberships",
column: "GroupId");
migrationBuilder.CreateIndex(
name: "IX_Groups_TenantId_Name",
table: "Groups",
columns: new[] { "TenantId", "Name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_TenantMemberships_RoleId",
table: "TenantMemberships",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "IX_TenantMemberships_TenantId",
table: "TenantMemberships",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_TenantRoles_TenantId_Name",
table: "TenantRoles",
columns: new[] { "TenantId", "Name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Tenants_Slug",
table: "Tenants",
column: "Slug",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GroupMemberships");
migrationBuilder.DropTable(
name: "TenantMemberships");
migrationBuilder.DropTable(
name: "Groups");
migrationBuilder.DropTable(
name: "TenantRoles");
migrationBuilder.DropTable(
name: "Tenants");
}
}
}

View File

@@ -0,0 +1,546 @@
// <auto-generated />
using System;
using EntKube.Web.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260516172611_AddEnvironmentsAndCustomers")]
partial class AddEnvironmentsAndCustomers
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.8");
modelBuilder.Entity("EntKube.Web.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Customers");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Environments");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Groups");
});
modelBuilder.Entity("EntKube.Web.Data.GroupMembership", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<Guid>("GroupId")
.HasColumnType("TEXT");
b.Property<DateTime>("JoinedAt")
.HasColumnType("TEXT");
b.HasKey("UserId", "GroupId");
b.HasIndex("GroupId");
b.ToTable("GroupMemberships");
});
modelBuilder.Entity("EntKube.Web.Data.Tenant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Tenants");
});
modelBuilder.Entity("EntKube.Web.Data.TenantMembership", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.Property<DateTime>("JoinedAt")
.HasColumnType("TEXT");
b.Property<Guid>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "TenantId");
b.HasIndex("RoleId");
b.HasIndex("TenantId");
b.ToTable("TenantMemberships");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("TenantRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Customers")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Environments")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Groups")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.GroupMembership", b =>
{
b.HasOne("EntKube.Web.Data.Group", "Group")
.WithMany("Memberships")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Group");
b.Navigation("User");
});
modelBuilder.Entity("EntKube.Web.Data.TenantMembership", b =>
{
b.HasOne("EntKube.Web.Data.TenantRole", "Role")
.WithMany("Memberships")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Memberships")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
b.Navigation("Tenant");
b.Navigation("User");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Roles")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.Navigation("Memberships");
});
modelBuilder.Entity("EntKube.Web.Data.Tenant", b =>
{
b.Navigation("Customers");
b.Navigation("Environments");
b.Navigation("Groups");
b.Navigation("Memberships");
b.Navigation("Roles");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.Navigation("Memberships");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,77 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddEnvironmentsAndCustomers : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Customers",
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),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Customers", x => x.Id);
table.ForeignKey(
name: "FK_Customers_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Environments",
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: 100, nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Environments", x => x.Id);
table.ForeignKey(
name: "FK_Environments_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Customers_TenantId_Name",
table: "Customers",
columns: new[] { "TenantId", "Name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Environments_TenantId_Name",
table: "Environments",
columns: new[] { "TenantId", "Name" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Customers");
migrationBuilder.DropTable(
name: "Environments");
}
}
}

View File

@@ -0,0 +1,634 @@
// <auto-generated />
using System;
using EntKube.Web.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260516173033_AddAppsAndAppEnvironments")]
partial class AddAppsAndAppEnvironments
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.8");
modelBuilder.Entity("EntKube.Web.Data.App", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<Guid>("CustomerId")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CustomerId", "Name")
.IsUnique();
b.ToTable("Apps");
});
modelBuilder.Entity("EntKube.Web.Data.AppEnvironment", b =>
{
b.Property<Guid>("AppId")
.HasColumnType("TEXT");
b.Property<Guid>("EnvironmentId")
.HasColumnType("TEXT");
b.Property<DateTime>("LinkedAt")
.HasColumnType("TEXT");
b.HasKey("AppId", "EnvironmentId");
b.HasIndex("EnvironmentId");
b.ToTable("AppEnvironments");
});
modelBuilder.Entity("EntKube.Web.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Customers");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Environments");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Groups");
});
modelBuilder.Entity("EntKube.Web.Data.GroupMembership", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<Guid>("GroupId")
.HasColumnType("TEXT");
b.Property<DateTime>("JoinedAt")
.HasColumnType("TEXT");
b.HasKey("UserId", "GroupId");
b.HasIndex("GroupId");
b.ToTable("GroupMemberships");
});
modelBuilder.Entity("EntKube.Web.Data.Tenant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Tenants");
});
modelBuilder.Entity("EntKube.Web.Data.TenantMembership", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.Property<DateTime>("JoinedAt")
.HasColumnType("TEXT");
b.Property<Guid>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "TenantId");
b.HasIndex("RoleId");
b.HasIndex("TenantId");
b.ToTable("TenantMemberships");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("TenantRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("EntKube.Web.Data.App", b =>
{
b.HasOne("EntKube.Web.Data.Customer", "Customer")
.WithMany("Apps")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Customer");
});
modelBuilder.Entity("EntKube.Web.Data.AppEnvironment", b =>
{
b.HasOne("EntKube.Web.Data.App", "App")
.WithMany("AppEnvironments")
.HasForeignKey("AppId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.Environment", "Environment")
.WithMany("AppEnvironments")
.HasForeignKey("EnvironmentId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("App");
b.Navigation("Environment");
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Customers")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Environments")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Groups")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.GroupMembership", b =>
{
b.HasOne("EntKube.Web.Data.Group", "Group")
.WithMany("Memberships")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Group");
b.Navigation("User");
});
modelBuilder.Entity("EntKube.Web.Data.TenantMembership", b =>
{
b.HasOne("EntKube.Web.Data.TenantRole", "Role")
.WithMany("Memberships")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Memberships")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
b.Navigation("Tenant");
b.Navigation("User");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Roles")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("EntKube.Web.Data.App", b =>
{
b.Navigation("AppEnvironments");
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.Navigation("Apps");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.Navigation("AppEnvironments");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.Navigation("Memberships");
});
modelBuilder.Entity("EntKube.Web.Data.Tenant", b =>
{
b.Navigation("Customers");
b.Navigation("Environments");
b.Navigation("Groups");
b.Navigation("Memberships");
b.Navigation("Roles");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.Navigation("Memberships");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,81 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddAppsAndAppEnvironments : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Apps",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
CustomerId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Apps", x => x.Id);
table.ForeignKey(
name: "FK_Apps_Customers_CustomerId",
column: x => x.CustomerId,
principalTable: "Customers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AppEnvironments",
columns: table => new
{
AppId = table.Column<Guid>(type: "TEXT", nullable: false),
EnvironmentId = table.Column<Guid>(type: "TEXT", nullable: false),
LinkedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppEnvironments", x => new { x.AppId, x.EnvironmentId });
table.ForeignKey(
name: "FK_AppEnvironments_Apps_AppId",
column: x => x.AppId,
principalTable: "Apps",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AppEnvironments_Environments_EnvironmentId",
column: x => x.EnvironmentId,
principalTable: "Environments",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_AppEnvironments_EnvironmentId",
table: "AppEnvironments",
column: "EnvironmentId");
migrationBuilder.CreateIndex(
name: "IX_Apps_CustomerId_Name",
table: "Apps",
columns: new[] { "CustomerId", "Name" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AppEnvironments");
migrationBuilder.DropTable(
name: "Apps");
}
}
}

View File

@@ -0,0 +1,692 @@
// <auto-generated />
using System;
using EntKube.Web.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260516173326_AddKubernetesClusters")]
partial class AddKubernetesClusters
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.8");
modelBuilder.Entity("EntKube.Web.Data.App", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<Guid>("CustomerId")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CustomerId", "Name")
.IsUnique();
b.ToTable("Apps");
});
modelBuilder.Entity("EntKube.Web.Data.AppEnvironment", b =>
{
b.Property<Guid>("AppId")
.HasColumnType("TEXT");
b.Property<Guid>("EnvironmentId")
.HasColumnType("TEXT");
b.Property<DateTime>("LinkedAt")
.HasColumnType("TEXT");
b.HasKey("AppId", "EnvironmentId");
b.HasIndex("EnvironmentId");
b.ToTable("AppEnvironments");
});
modelBuilder.Entity("EntKube.Web.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Customers");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Environments");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Groups");
});
modelBuilder.Entity("EntKube.Web.Data.GroupMembership", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<Guid>("GroupId")
.HasColumnType("TEXT");
b.Property<DateTime>("JoinedAt")
.HasColumnType("TEXT");
b.HasKey("UserId", "GroupId");
b.HasIndex("GroupId");
b.ToTable("GroupMemberships");
});
modelBuilder.Entity("EntKube.Web.Data.KubernetesCluster", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("ApiServerUrl")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<Guid>("EnvironmentId")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("EnvironmentId");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("KubernetesClusters");
});
modelBuilder.Entity("EntKube.Web.Data.Tenant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Tenants");
});
modelBuilder.Entity("EntKube.Web.Data.TenantMembership", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.Property<DateTime>("JoinedAt")
.HasColumnType("TEXT");
b.Property<Guid>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "TenantId");
b.HasIndex("RoleId");
b.HasIndex("TenantId");
b.ToTable("TenantMemberships");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("TenantRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("EntKube.Web.Data.App", b =>
{
b.HasOne("EntKube.Web.Data.Customer", "Customer")
.WithMany("Apps")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Customer");
});
modelBuilder.Entity("EntKube.Web.Data.AppEnvironment", b =>
{
b.HasOne("EntKube.Web.Data.App", "App")
.WithMany("AppEnvironments")
.HasForeignKey("AppId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.Environment", "Environment")
.WithMany("AppEnvironments")
.HasForeignKey("EnvironmentId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("App");
b.Navigation("Environment");
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Customers")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Environments")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Groups")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.GroupMembership", b =>
{
b.HasOne("EntKube.Web.Data.Group", "Group")
.WithMany("Memberships")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Group");
b.Navigation("User");
});
modelBuilder.Entity("EntKube.Web.Data.KubernetesCluster", b =>
{
b.HasOne("EntKube.Web.Data.Environment", "Environment")
.WithMany("KubernetesClusters")
.HasForeignKey("EnvironmentId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("KubernetesClusters")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Environment");
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.TenantMembership", b =>
{
b.HasOne("EntKube.Web.Data.TenantRole", "Role")
.WithMany("Memberships")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Memberships")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
b.Navigation("Tenant");
b.Navigation("User");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Roles")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("EntKube.Web.Data.App", b =>
{
b.Navigation("AppEnvironments");
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.Navigation("Apps");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.Navigation("AppEnvironments");
b.Navigation("KubernetesClusters");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.Navigation("Memberships");
});
modelBuilder.Entity("EntKube.Web.Data.Tenant", b =>
{
b.Navigation("Customers");
b.Navigation("Environments");
b.Navigation("Groups");
b.Navigation("KubernetesClusters");
b.Navigation("Memberships");
b.Navigation("Roles");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.Navigation("Memberships");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,61 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddKubernetesClusters : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "KubernetesClusters",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
EnvironmentId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
ApiServerUrl = table.Column<string>(type: "TEXT", maxLength: 500, nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_KubernetesClusters", x => x.Id);
table.ForeignKey(
name: "FK_KubernetesClusters_Environments_EnvironmentId",
column: x => x.EnvironmentId,
principalTable: "Environments",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_KubernetesClusters_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_KubernetesClusters_EnvironmentId",
table: "KubernetesClusters",
column: "EnvironmentId");
migrationBuilder.CreateIndex(
name: "IX_KubernetesClusters_TenantId_Name",
table: "KubernetesClusters",
columns: new[] { "TenantId", "Name" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "KubernetesClusters");
}
}
}

View File

@@ -0,0 +1,876 @@
// <auto-generated />
using System;
using EntKube.Web.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260516180036_AddVaultAndComponents")]
partial class AddVaultAndComponents
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.8");
modelBuilder.Entity("EntKube.Web.Data.App", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<Guid>("CustomerId")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CustomerId", "Name")
.IsUnique();
b.ToTable("Apps");
});
modelBuilder.Entity("EntKube.Web.Data.AppEnvironment", b =>
{
b.Property<Guid>("AppId")
.HasColumnType("TEXT");
b.Property<Guid>("EnvironmentId")
.HasColumnType("TEXT");
b.Property<DateTime>("LinkedAt")
.HasColumnType("TEXT");
b.HasKey("AppId", "EnvironmentId");
b.HasIndex("EnvironmentId");
b.ToTable("AppEnvironments");
});
modelBuilder.Entity("EntKube.Web.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("EntKube.Web.Data.ClusterComponent", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid>("ClusterId")
.HasColumnType("TEXT");
b.Property<string>("ComponentType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ClusterId", "Name")
.IsUnique();
b.ToTable("ClusterComponents");
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Customers");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Environments");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Groups");
});
modelBuilder.Entity("EntKube.Web.Data.GroupMembership", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<Guid>("GroupId")
.HasColumnType("TEXT");
b.Property<DateTime>("JoinedAt")
.HasColumnType("TEXT");
b.HasKey("UserId", "GroupId");
b.HasIndex("GroupId");
b.ToTable("GroupMemberships");
});
modelBuilder.Entity("EntKube.Web.Data.KubernetesCluster", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("ApiServerUrl")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<Guid>("EnvironmentId")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("EnvironmentId");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("KubernetesClusters");
});
modelBuilder.Entity("EntKube.Web.Data.SecretVault", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<byte[]>("EncryptedDataKey")
.IsRequired()
.HasColumnType("BLOB");
b.Property<byte[]>("Nonce")
.IsRequired()
.HasColumnType("BLOB");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId")
.IsUnique();
b.ToTable("SecretVaults");
});
modelBuilder.Entity("EntKube.Web.Data.Tenant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Tenants");
});
modelBuilder.Entity("EntKube.Web.Data.TenantMembership", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.Property<DateTime>("JoinedAt")
.HasColumnType("TEXT");
b.Property<Guid>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "TenantId");
b.HasIndex("RoleId");
b.HasIndex("TenantId");
b.ToTable("TenantMemberships");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("TenantRoles");
});
modelBuilder.Entity("EntKube.Web.Data.VaultSecret", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid?>("AppId")
.HasColumnType("TEXT");
b.Property<Guid?>("ComponentId")
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<byte[]>("EncryptedValue")
.IsRequired()
.HasColumnType("BLOB");
b.Property<string>("KubernetesNamespace")
.HasMaxLength(63)
.HasColumnType("TEXT");
b.Property<string>("KubernetesSecretName")
.HasMaxLength(253)
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<byte[]>("Nonce")
.IsRequired()
.HasColumnType("BLOB");
b.Property<bool>("SyncToKubernetes")
.HasColumnType("INTEGER");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("TEXT");
b.Property<Guid>("VaultId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("AppId");
b.HasIndex("ComponentId");
b.HasIndex("VaultId", "AppId", "Name")
.IsUnique();
b.HasIndex("VaultId", "ComponentId", "Name")
.IsUnique();
b.ToTable("VaultSecrets");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("EntKube.Web.Data.App", b =>
{
b.HasOne("EntKube.Web.Data.Customer", "Customer")
.WithMany("Apps")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Customer");
});
modelBuilder.Entity("EntKube.Web.Data.AppEnvironment", b =>
{
b.HasOne("EntKube.Web.Data.App", "App")
.WithMany("AppEnvironments")
.HasForeignKey("AppId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.Environment", "Environment")
.WithMany("AppEnvironments")
.HasForeignKey("EnvironmentId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("App");
b.Navigation("Environment");
});
modelBuilder.Entity("EntKube.Web.Data.ClusterComponent", b =>
{
b.HasOne("EntKube.Web.Data.KubernetesCluster", "Cluster")
.WithMany("Components")
.HasForeignKey("ClusterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cluster");
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Customers")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Environments")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Groups")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.GroupMembership", b =>
{
b.HasOne("EntKube.Web.Data.Group", "Group")
.WithMany("Memberships")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Group");
b.Navigation("User");
});
modelBuilder.Entity("EntKube.Web.Data.KubernetesCluster", b =>
{
b.HasOne("EntKube.Web.Data.Environment", "Environment")
.WithMany("KubernetesClusters")
.HasForeignKey("EnvironmentId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("KubernetesClusters")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Environment");
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.SecretVault", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithOne("Vault")
.HasForeignKey("EntKube.Web.Data.SecretVault", "TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.TenantMembership", b =>
{
b.HasOne("EntKube.Web.Data.TenantRole", "Role")
.WithMany("Memberships")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Memberships")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
b.Navigation("Tenant");
b.Navigation("User");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Roles")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.VaultSecret", b =>
{
b.HasOne("EntKube.Web.Data.App", "App")
.WithMany("Secrets")
.HasForeignKey("AppId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("EntKube.Web.Data.ClusterComponent", "Component")
.WithMany("Secrets")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("EntKube.Web.Data.SecretVault", "Vault")
.WithMany("Secrets")
.HasForeignKey("VaultId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("App");
b.Navigation("Component");
b.Navigation("Vault");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("EntKube.Web.Data.App", b =>
{
b.Navigation("AppEnvironments");
b.Navigation("Secrets");
});
modelBuilder.Entity("EntKube.Web.Data.ClusterComponent", b =>
{
b.Navigation("Secrets");
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.Navigation("Apps");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.Navigation("AppEnvironments");
b.Navigation("KubernetesClusters");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.Navigation("Memberships");
});
modelBuilder.Entity("EntKube.Web.Data.KubernetesCluster", b =>
{
b.Navigation("Components");
});
modelBuilder.Entity("EntKube.Web.Data.SecretVault", b =>
{
b.Navigation("Secrets");
});
modelBuilder.Entity("EntKube.Web.Data.Tenant", b =>
{
b.Navigation("Customers");
b.Navigation("Environments");
b.Navigation("Groups");
b.Navigation("KubernetesClusters");
b.Navigation("Memberships");
b.Navigation("Roles");
b.Navigation("Vault");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.Navigation("Memberships");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,144 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddVaultAndComponents : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ClusterComponents",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
ClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
ComponentType = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClusterComponents", x => x.Id);
table.ForeignKey(
name: "FK_ClusterComponents_KubernetesClusters_ClusterId",
column: x => x.ClusterId,
principalTable: "KubernetesClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "SecretVaults",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
EncryptedDataKey = table.Column<byte[]>(type: "BLOB", nullable: false),
Nonce = table.Column<byte[]>(type: "BLOB", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SecretVaults", x => x.Id);
table.ForeignKey(
name: "FK_SecretVaults_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "VaultSecrets",
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),
EncryptedValue = table.Column<byte[]>(type: "BLOB", nullable: false),
Nonce = table.Column<byte[]>(type: "BLOB", nullable: false),
AppId = table.Column<Guid>(type: "TEXT", nullable: true),
ComponentId = table.Column<Guid>(type: "TEXT", nullable: true),
SyncToKubernetes = table.Column<bool>(type: "INTEGER", nullable: false),
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_VaultSecrets", x => x.Id);
table.ForeignKey(
name: "FK_VaultSecrets_Apps_AppId",
column: x => x.AppId,
principalTable: "Apps",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_VaultSecrets_ClusterComponents_ComponentId",
column: x => x.ComponentId,
principalTable: "ClusterComponents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_VaultSecrets_SecretVaults_VaultId",
column: x => x.VaultId,
principalTable: "SecretVaults",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ClusterComponents_ClusterId_Name",
table: "ClusterComponents",
columns: new[] { "ClusterId", "Name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_SecretVaults_TenantId",
table: "SecretVaults",
column: "TenantId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_AppId",
table: "VaultSecrets",
column: "AppId");
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_ComponentId",
table: "VaultSecrets",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_VaultId_AppId_Name",
table: "VaultSecrets",
columns: new[] { "VaultId", "AppId", "Name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_VaultId_ComponentId_Name",
table: "VaultSecrets",
columns: new[] { "VaultId", "ComponentId", "Name" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "VaultSecrets");
migrationBuilder.DropTable(
name: "ClusterComponents");
migrationBuilder.DropTable(
name: "SecretVaults");
}
}
}

View File

@@ -0,0 +1,882 @@
// <auto-generated />
using System;
using EntKube.Web.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260516183615_AddKubeconfigToCluster")]
partial class AddKubeconfigToCluster
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.8");
modelBuilder.Entity("EntKube.Web.Data.App", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<Guid>("CustomerId")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CustomerId", "Name")
.IsUnique();
b.ToTable("Apps");
});
modelBuilder.Entity("EntKube.Web.Data.AppEnvironment", b =>
{
b.Property<Guid>("AppId")
.HasColumnType("TEXT");
b.Property<Guid>("EnvironmentId")
.HasColumnType("TEXT");
b.Property<DateTime>("LinkedAt")
.HasColumnType("TEXT");
b.HasKey("AppId", "EnvironmentId");
b.HasIndex("EnvironmentId");
b.ToTable("AppEnvironments");
});
modelBuilder.Entity("EntKube.Web.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("EntKube.Web.Data.ClusterComponent", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid>("ClusterId")
.HasColumnType("TEXT");
b.Property<string>("ComponentType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ClusterId", "Name")
.IsUnique();
b.ToTable("ClusterComponents");
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Customers");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Environments");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("Groups");
});
modelBuilder.Entity("EntKube.Web.Data.GroupMembership", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<Guid>("GroupId")
.HasColumnType("TEXT");
b.Property<DateTime>("JoinedAt")
.HasColumnType("TEXT");
b.HasKey("UserId", "GroupId");
b.HasIndex("GroupId");
b.ToTable("GroupMemberships");
});
modelBuilder.Entity("EntKube.Web.Data.KubernetesCluster", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("ApiServerUrl")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<string>("ContextName")
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<Guid>("EnvironmentId")
.HasColumnType("TEXT");
b.Property<string>("Kubeconfig")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("EnvironmentId");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("KubernetesClusters");
});
modelBuilder.Entity("EntKube.Web.Data.SecretVault", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<byte[]>("EncryptedDataKey")
.IsRequired()
.HasColumnType("BLOB");
b.Property<byte[]>("Nonce")
.IsRequired()
.HasColumnType("BLOB");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId")
.IsUnique();
b.ToTable("SecretVaults");
});
modelBuilder.Entity("EntKube.Web.Data.Tenant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("Slug")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Tenants");
});
modelBuilder.Entity("EntKube.Web.Data.TenantMembership", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.Property<DateTime>("JoinedAt")
.HasColumnType("TEXT");
b.Property<Guid>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "TenantId");
b.HasIndex("RoleId");
b.HasIndex("TenantId");
b.ToTable("TenantMemberships");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<Guid>("TenantId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("TenantId", "Name")
.IsUnique();
b.ToTable("TenantRoles");
});
modelBuilder.Entity("EntKube.Web.Data.VaultSecret", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid?>("AppId")
.HasColumnType("TEXT");
b.Property<Guid?>("ComponentId")
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.HasColumnType("TEXT");
b.Property<byte[]>("EncryptedValue")
.IsRequired()
.HasColumnType("BLOB");
b.Property<string>("KubernetesNamespace")
.HasMaxLength(63)
.HasColumnType("TEXT");
b.Property<string>("KubernetesSecretName")
.HasMaxLength(253)
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<byte[]>("Nonce")
.IsRequired()
.HasColumnType("BLOB");
b.Property<bool>("SyncToKubernetes")
.HasColumnType("INTEGER");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("TEXT");
b.Property<Guid>("VaultId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("AppId");
b.HasIndex("ComponentId");
b.HasIndex("VaultId", "AppId", "Name")
.IsUnique();
b.HasIndex("VaultId", "ComponentId", "Name")
.IsUnique();
b.ToTable("VaultSecrets");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("EntKube.Web.Data.App", b =>
{
b.HasOne("EntKube.Web.Data.Customer", "Customer")
.WithMany("Apps")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Customer");
});
modelBuilder.Entity("EntKube.Web.Data.AppEnvironment", b =>
{
b.HasOne("EntKube.Web.Data.App", "App")
.WithMany("AppEnvironments")
.HasForeignKey("AppId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.Environment", "Environment")
.WithMany("AppEnvironments")
.HasForeignKey("EnvironmentId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("App");
b.Navigation("Environment");
});
modelBuilder.Entity("EntKube.Web.Data.ClusterComponent", b =>
{
b.HasOne("EntKube.Web.Data.KubernetesCluster", "Cluster")
.WithMany("Components")
.HasForeignKey("ClusterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cluster");
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Customers")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Environments")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Groups")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.GroupMembership", b =>
{
b.HasOne("EntKube.Web.Data.Group", "Group")
.WithMany("Memberships")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Group");
b.Navigation("User");
});
modelBuilder.Entity("EntKube.Web.Data.KubernetesCluster", b =>
{
b.HasOne("EntKube.Web.Data.Environment", "Environment")
.WithMany("KubernetesClusters")
.HasForeignKey("EnvironmentId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("KubernetesClusters")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Environment");
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.SecretVault", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithOne("Vault")
.HasForeignKey("EntKube.Web.Data.SecretVault", "TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.TenantMembership", b =>
{
b.HasOne("EntKube.Web.Data.TenantRole", "Role")
.WithMany("Memberships")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Memberships")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
b.Navigation("Tenant");
b.Navigation("User");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.HasOne("EntKube.Web.Data.Tenant", "Tenant")
.WithMany("Roles")
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("EntKube.Web.Data.VaultSecret", b =>
{
b.HasOne("EntKube.Web.Data.App", "App")
.WithMany("Secrets")
.HasForeignKey("AppId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("EntKube.Web.Data.ClusterComponent", "Component")
.WithMany("Secrets")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("EntKube.Web.Data.SecretVault", "Vault")
.WithMany("Secrets")
.HasForeignKey("VaultId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("App");
b.Navigation("Component");
b.Navigation("Vault");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("EntKube.Web.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("EntKube.Web.Data.App", b =>
{
b.Navigation("AppEnvironments");
b.Navigation("Secrets");
});
modelBuilder.Entity("EntKube.Web.Data.ClusterComponent", b =>
{
b.Navigation("Secrets");
});
modelBuilder.Entity("EntKube.Web.Data.Customer", b =>
{
b.Navigation("Apps");
});
modelBuilder.Entity("EntKube.Web.Data.Environment", b =>
{
b.Navigation("AppEnvironments");
b.Navigation("KubernetesClusters");
});
modelBuilder.Entity("EntKube.Web.Data.Group", b =>
{
b.Navigation("Memberships");
});
modelBuilder.Entity("EntKube.Web.Data.KubernetesCluster", b =>
{
b.Navigation("Components");
});
modelBuilder.Entity("EntKube.Web.Data.SecretVault", b =>
{
b.Navigation("Secrets");
});
modelBuilder.Entity("EntKube.Web.Data.Tenant", b =>
{
b.Navigation("Customers");
b.Navigation("Environments");
b.Navigation("Groups");
b.Navigation("KubernetesClusters");
b.Navigation("Memberships");
b.Navigation("Roles");
b.Navigation("Vault");
});
modelBuilder.Entity("EntKube.Web.Data.TenantRole", b =>
{
b.Navigation("Memberships");
});
#pragma warning restore 612, 618
}
}
}

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,162 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddAppDeployments : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AppDeployments",
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: 200, nullable: false),
Type = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
EnvironmentId = table.Column<Guid>(type: "TEXT", nullable: false),
ClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
Namespace = table.Column<string>(type: "TEXT", maxLength: 63, nullable: false),
SyncStatus = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
HealthStatus = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
StatusMessage = table.Column<string>(type: "TEXT", nullable: true),
LastSyncedAt = table.Column<DateTime>(type: "TEXT", nullable: true),
HelmRepoUrl = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true),
HelmChartName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true),
HelmChartVersion = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
HelmValues = table.Column<string>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppDeployments", x => x.Id);
table.ForeignKey(
name: "FK_AppDeployments_Apps_AppId",
column: x => x.AppId,
principalTable: "Apps",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AppDeployments_Environments_EnvironmentId",
column: x => x.EnvironmentId,
principalTable: "Environments",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_AppDeployments_KubernetesClusters_ClusterId",
column: x => x.ClusterId,
principalTable: "KubernetesClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "DeploymentManifests",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
DeploymentId = table.Column<Guid>(type: "TEXT", nullable: false),
Kind = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 253, nullable: false),
SortOrder = table.Column<int>(type: "INTEGER", nullable: false),
YamlContent = table.Column<string>(type: "TEXT", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DeploymentManifests", x => x.Id);
table.ForeignKey(
name: "FK_DeploymentManifests_AppDeployments_DeploymentId",
column: x => x.DeploymentId,
principalTable: "AppDeployments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DeploymentResources",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
DeploymentId = table.Column<Guid>(type: "TEXT", nullable: false),
Group = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
Version = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
Kind = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 253, nullable: false),
Namespace = table.Column<string>(type: "TEXT", maxLength: 63, nullable: true),
SyncStatus = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
HealthStatus = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
StatusMessage = table.Column<string>(type: "TEXT", nullable: true),
ParentResourceId = table.Column<Guid>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
LastUpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DeploymentResources", x => x.Id);
table.ForeignKey(
name: "FK_DeploymentResources_AppDeployments_DeploymentId",
column: x => x.DeploymentId,
principalTable: "AppDeployments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DeploymentResources_DeploymentResources_ParentResourceId",
column: x => x.ParentResourceId,
principalTable: "DeploymentResources",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_AppDeployments_AppId_Name",
table: "AppDeployments",
columns: new[] { "AppId", "Name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AppDeployments_ClusterId",
table: "AppDeployments",
column: "ClusterId");
migrationBuilder.CreateIndex(
name: "IX_AppDeployments_EnvironmentId",
table: "AppDeployments",
column: "EnvironmentId");
migrationBuilder.CreateIndex(
name: "IX_DeploymentManifests_DeploymentId",
table: "DeploymentManifests",
column: "DeploymentId");
migrationBuilder.CreateIndex(
name: "IX_DeploymentResources_DeploymentId",
table: "DeploymentResources",
column: "DeploymentId");
migrationBuilder.CreateIndex(
name: "IX_DeploymentResources_ParentResourceId",
table: "DeploymentResources",
column: "ParentResourceId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DeploymentManifests");
migrationBuilder.DropTable(
name: "DeploymentResources");
migrationBuilder.DropTable(
name: "AppDeployments");
}
}
}

View File

@@ -0,0 +1,53 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddCustomerAccessAndDeployments : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CustomerAccesses",
columns: table => new
{
UserId = table.Column<string>(type: "TEXT", nullable: false),
CustomerId = table.Column<Guid>(type: "TEXT", nullable: false),
Role = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
GrantedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomerAccesses", x => new { x.UserId, x.CustomerId });
table.ForeignKey(
name: "FK_CustomerAccesses_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CustomerAccesses_Customers_CustomerId",
column: x => x.CustomerId,
principalTable: "Customers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CustomerAccesses_CustomerId",
table: "CustomerAccesses",
column: "CustomerId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CustomerAccesses");
}
}
}

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,110 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddComponentLifecycleFields : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "HelmChartName",
table: "ClusterComponents",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "HelmChartVersion",
table: "ClusterComponents",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "HelmRepoUrl",
table: "ClusterComponents",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "HelmValues",
table: "ClusterComponents",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "InstalledAt",
table: "ClusterComponents",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "LastError",
table: "ClusterComponents",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Namespace",
table: "ClusterComponents",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ReleaseName",
table: "ClusterComponents",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "Status",
table: "ClusterComponents",
type: "INTEGER",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "HelmChartName",
table: "ClusterComponents");
migrationBuilder.DropColumn(
name: "HelmChartVersion",
table: "ClusterComponents");
migrationBuilder.DropColumn(
name: "HelmRepoUrl",
table: "ClusterComponents");
migrationBuilder.DropColumn(
name: "HelmValues",
table: "ClusterComponents");
migrationBuilder.DropColumn(
name: "InstalledAt",
table: "ClusterComponents");
migrationBuilder.DropColumn(
name: "LastError",
table: "ClusterComponents");
migrationBuilder.DropColumn(
name: "Namespace",
table: "ClusterComponents");
migrationBuilder.DropColumn(
name: "ReleaseName",
table: "ClusterComponents");
migrationBuilder.DropColumn(
name: "Status",
table: "ClusterComponents");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,56 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddExternalRoutes : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ExternalRoutes",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
ComponentId = table.Column<Guid>(type: "TEXT", nullable: false),
Hostname = table.Column<string>(type: "TEXT", maxLength: 253, nullable: false),
ServiceName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true),
ServicePort = table.Column<int>(type: "INTEGER", nullable: false),
PathPrefix = table.Column<string>(type: "TEXT", maxLength: 200, 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),
GatewayName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: true),
GatewayNamespace = table.Column<string>(type: "TEXT", maxLength: 63, nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ExternalRoutes", x => x.Id);
table.ForeignKey(
name: "FK_ExternalRoutes_ClusterComponents_ComponentId",
column: x => x.ComponentId,
principalTable: "ClusterComponents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ExternalRoutes_ComponentId",
table: "ExternalRoutes",
column: "ComponentId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ExternalRoutes");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,161 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddStorageAndOpenStack : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "OpenStackConnectionId",
table: "VaultSecrets",
type: "TEXT",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "StorageLinkId",
table: "VaultSecrets",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "OpenStackConnections",
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", nullable: false),
AuthUrl = table.Column<string>(type: "TEXT", nullable: false),
Region = table.Column<string>(type: "TEXT", nullable: true),
ProjectName = table.Column<string>(type: "TEXT", nullable: true),
ProjectId = table.Column<string>(type: "TEXT", nullable: true),
UserDomainName = table.Column<string>(type: "TEXT", nullable: true),
ProjectDomainName = table.Column<string>(type: "TEXT", nullable: true),
Username = table.Column<string>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OpenStackConnections", x => x.Id);
table.ForeignKey(
name: "FK_OpenStackConnections_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "StorageLinks",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
TenantId = table.Column<Guid>(type: "TEXT", nullable: false),
EnvironmentId = table.Column<Guid>(type: "TEXT", nullable: false),
Provider = table.Column<int>(type: "INTEGER", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Endpoint = table.Column<string>(type: "TEXT", nullable: true),
BucketName = table.Column<string>(type: "TEXT", nullable: true),
Region = table.Column<string>(type: "TEXT", nullable: true),
ComponentId = table.Column<Guid>(type: "TEXT", nullable: true),
OpenStackConnectionId = table.Column<Guid>(type: "TEXT", nullable: true),
Notes = table.Column<string>(type: "TEXT", nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_StorageLinks", x => x.Id);
table.ForeignKey(
name: "FK_StorageLinks_ClusterComponents_ComponentId",
column: x => x.ComponentId,
principalTable: "ClusterComponents",
principalColumn: "Id");
table.ForeignKey(
name: "FK_StorageLinks_Environments_EnvironmentId",
column: x => x.EnvironmentId,
principalTable: "Environments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_StorageLinks_OpenStackConnections_OpenStackConnectionId",
column: x => x.OpenStackConnectionId,
principalTable: "OpenStackConnections",
principalColumn: "Id");
table.ForeignKey(
name: "FK_StorageLinks_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_StorageLinkId",
table: "VaultSecrets",
column: "StorageLinkId");
migrationBuilder.CreateIndex(
name: "IX_OpenStackConnections_TenantId",
table: "OpenStackConnections",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_StorageLinks_ComponentId",
table: "StorageLinks",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_StorageLinks_EnvironmentId",
table: "StorageLinks",
column: "EnvironmentId");
migrationBuilder.CreateIndex(
name: "IX_StorageLinks_OpenStackConnectionId",
table: "StorageLinks",
column: "OpenStackConnectionId");
migrationBuilder.CreateIndex(
name: "IX_StorageLinks_TenantId",
table: "StorageLinks",
column: "TenantId");
migrationBuilder.AddForeignKey(
name: "FK_VaultSecrets_StorageLinks_StorageLinkId",
table: "VaultSecrets",
column: "StorageLinkId",
principalTable: "StorageLinks",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_VaultSecrets_StorageLinks_StorageLinkId",
table: "VaultSecrets");
migrationBuilder.DropTable(
name: "StorageLinks");
migrationBuilder.DropTable(
name: "OpenStackConnections");
migrationBuilder.DropIndex(
name: "IX_VaultSecrets_StorageLinkId",
table: "VaultSecrets");
migrationBuilder.DropColumn(
name: "OpenStackConnectionId",
table: "VaultSecrets");
migrationBuilder.DropColumn(
name: "StorageLinkId",
table: "VaultSecrets");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,73 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddStorageBindings : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "StorageBindings",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
StorageLinkId = table.Column<Guid>(type: "TEXT", nullable: false),
AppDeploymentId = table.Column<Guid>(type: "TEXT", nullable: true),
ComponentId = table.Column<Guid>(type: "TEXT", 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_StorageBindings", x => x.Id);
table.ForeignKey(
name: "FK_StorageBindings_AppDeployments_AppDeploymentId",
column: x => x.AppDeploymentId,
principalTable: "AppDeployments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_StorageBindings_ClusterComponents_ComponentId",
column: x => x.ComponentId,
principalTable: "ClusterComponents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_StorageBindings_StorageLinks_StorageLinkId",
column: x => x.StorageLinkId,
principalTable: "StorageLinks",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_StorageBindings_AppDeploymentId",
table: "StorageBindings",
column: "AppDeploymentId");
migrationBuilder.CreateIndex(
name: "IX_StorageBindings_ComponentId",
table: "StorageBindings",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_StorageBindings_StorageLinkId",
table: "StorageBindings",
column: "StorageLinkId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "StorageBindings");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,175 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EntKube.Web.Data.Migrations.Sqlite
{
/// <inheritdoc />
public partial class AddCnpgManagement : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "CnpgDatabaseId",
table: "VaultSecrets",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "CnpgClusters",
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),
PostgresVersion = table.Column<string>(type: "TEXT", maxLength: 10, nullable: false),
Instances = table.Column<int>(type: "INTEGER", nullable: false),
StorageSize = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
StorageLinkId = table.Column<Guid>(type: "TEXT", nullable: true),
BackupSchedule = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
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_CnpgClusters", x => x.Id);
table.ForeignKey(
name: "FK_CnpgClusters_KubernetesClusters_KubernetesClusterId",
column: x => x.KubernetesClusterId,
principalTable: "KubernetesClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CnpgClusters_StorageLinks_StorageLinkId",
column: x => x.StorageLinkId,
principalTable: "StorageLinks",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_CnpgClusters_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CnpgBackups",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
CnpgClusterId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 253, nullable: false),
Type = table.Column<int>(type: "INTEGER", nullable: false),
Status = table.Column<int>(type: "INTEGER", nullable: false),
StartedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
CompletedAt = table.Column<DateTime>(type: "TEXT", nullable: true),
SizeBytes = table.Column<long>(type: "INTEGER", nullable: true),
LastError = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CnpgBackups", x => x.Id);
table.ForeignKey(
name: "FK_CnpgBackups_CnpgClusters_CnpgClusterId",
column: x => x.CnpgClusterId,
principalTable: "CnpgClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CnpgDatabases",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
CnpgClusterId = 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_CnpgDatabases", x => x.Id);
table.ForeignKey(
name: "FK_CnpgDatabases_CnpgClusters_CnpgClusterId",
column: x => x.CnpgClusterId,
principalTable: "CnpgClusters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_VaultSecrets_CnpgDatabaseId",
table: "VaultSecrets",
column: "CnpgDatabaseId");
migrationBuilder.CreateIndex(
name: "IX_CnpgBackups_CnpgClusterId_Name",
table: "CnpgBackups",
columns: new[] { "CnpgClusterId", "Name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_CnpgClusters_KubernetesClusterId_Name_Namespace",
table: "CnpgClusters",
columns: new[] { "KubernetesClusterId", "Name", "Namespace" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_CnpgClusters_StorageLinkId",
table: "CnpgClusters",
column: "StorageLinkId");
migrationBuilder.CreateIndex(
name: "IX_CnpgClusters_TenantId",
table: "CnpgClusters",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_CnpgDatabases_CnpgClusterId_Name",
table: "CnpgDatabases",
columns: new[] { "CnpgClusterId", "Name" },
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_VaultSecrets_CnpgDatabases_CnpgDatabaseId",
table: "VaultSecrets",
column: "CnpgDatabaseId",
principalTable: "CnpgDatabases",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_VaultSecrets_CnpgDatabases_CnpgDatabaseId",
table: "VaultSecrets");
migrationBuilder.DropTable(
name: "CnpgBackups");
migrationBuilder.DropTable(
name: "CnpgDatabases");
migrationBuilder.DropTable(
name: "CnpgClusters");
migrationBuilder.DropIndex(
name: "IX_VaultSecrets_CnpgDatabaseId",
table: "VaultSecrets");
migrationBuilder.DropColumn(
name: "CnpgDatabaseId",
table: "VaultSecrets");
}
}
}

File diff suppressed because it is too large Load Diff