This commit is contained in:
Paul Schneider 2021-05-16 14:07:14 +01:00
commit e4511a8aaa
38 changed files with 615 additions and 68 deletions

View file

@ -128,7 +128,7 @@ namespace nugethost.Migrations
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("nuget_host.Models.ApplicationUser", b =>
modelBuilder.Entity("nuget_host.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
@ -190,7 +190,7 @@ namespace nugethost.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@ -198,7 +198,7 @@ namespace nugethost.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@ -211,7 +211,7 @@ namespace nugethost.Migrations
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@ -219,7 +219,7 @@ namespace nugethost.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);

View file

@ -128,7 +128,7 @@ namespace nugethost.Migrations
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("nuget_host.Models.ApiKey", b =>
modelBuilder.Entity("nuget_host.Data.ApiKey", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
@ -143,7 +143,7 @@ namespace nugethost.Migrations
b.ToTable("ApiKeys");
});
modelBuilder.Entity("nuget_host.Models.ApplicationUser", b =>
modelBuilder.Entity("nuget_host.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
@ -205,7 +205,7 @@ namespace nugethost.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@ -213,7 +213,7 @@ namespace nugethost.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@ -226,7 +226,7 @@ namespace nugethost.Migrations
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@ -234,15 +234,15 @@ namespace nugethost.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("nuget_host.Models.ApiKey", b =>
modelBuilder.Entity("nuget_host.Data.ApiKey", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser", "User")
b.HasOne("nuget_host.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);

View file

@ -128,7 +128,7 @@ namespace nugethost.Migrations
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("nuget_host.Models.ApiKeys.ApiKey", b =>
modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
@ -149,7 +149,7 @@ namespace nugethost.Migrations
b.ToTable("ApiKeys");
});
modelBuilder.Entity("nuget_host.Models.ApplicationUser", b =>
modelBuilder.Entity("nuget_host.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
@ -211,7 +211,7 @@ namespace nugethost.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@ -219,7 +219,7 @@ namespace nugethost.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@ -232,7 +232,7 @@ namespace nugethost.Migrations
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@ -240,15 +240,15 @@ namespace nugethost.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("nuget_host.Models.ApiKeys.ApiKey", b =>
modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser", "User")
b.HasOne("nuget_host.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);

View file

@ -0,0 +1,316 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using nuget_host.Data;
namespace nugethost.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20210516060430_packages")]
partial class packages
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationDate");
b.Property<string>("Name");
b.Property<string>("UserId")
.IsRequired();
b.Property<int>("ValidityPeriodInDays");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("ApiKeys");
});
modelBuilder.Entity("nuget_host.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("FullName");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("nuget_host.Data.Package", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("OwnerId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("OwnerId");
b.ToTable("Packages");
});
modelBuilder.Entity("nuget_host.Data.PackageVersion", b =>
{
b.Property<string>("FullString")
.ValueGeneratedOnAdd()
.HasMaxLength(32);
b.Property<bool>("IsPrerelease");
b.Property<int>("Major");
b.Property<int>("Minor");
b.Property<string>("PackageId")
.IsRequired();
b.Property<int>("Patch");
b.HasKey("FullString");
b.HasIndex("PackageId");
b.ToTable("PackageVersions");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b =>
{
b.HasOne("nuget_host.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("nuget_host.Data.Package", b =>
{
b.HasOne("nuget_host.Data.ApplicationUser", "Owner")
.WithMany()
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("nuget_host.Data.PackageVersion", b =>
{
b.HasOne("nuget_host.Data.Package", "Package")
.WithMany()
.HasForeignKey("PackageId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,70 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace nugethost.Migrations
{
public partial class packages : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Packages",
columns: table => new
{
Id = table.Column<string>(nullable: false),
OwnerId = table.Column<string>(nullable: false),
Description = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Packages", x => x.Id);
table.ForeignKey(
name: "FK_Packages_AspNetUsers_OwnerId",
column: x => x.OwnerId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PackageVersions",
columns: table => new
{
FullString = table.Column<string>(maxLength: 32, nullable: false),
PackageId = table.Column<string>(nullable: false),
Major = table.Column<int>(nullable: false),
Minor = table.Column<int>(nullable: false),
Patch = table.Column<int>(nullable: false),
IsPrerelease = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PackageVersions", x => x.FullString);
table.ForeignKey(
name: "FK_PackageVersions_Packages_PackageId",
column: x => x.PackageId,
principalTable: "Packages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Packages_OwnerId",
table: "Packages",
column: "OwnerId");
migrationBuilder.CreateIndex(
name: "IX_PackageVersions_PackageId",
table: "PackageVersions",
column: "PackageId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PackageVersions");
migrationBuilder.DropTable(
name: "Packages");
}
}
}

View file

@ -126,7 +126,7 @@ namespace nugethost.Migrations
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("nuget_host.Models.ApiKeys.ApiKey", b =>
modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
@ -147,7 +147,7 @@ namespace nugethost.Migrations
b.ToTable("ApiKeys");
});
modelBuilder.Entity("nuget_host.Models.ApplicationUser", b =>
modelBuilder.Entity("nuget_host.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
@ -199,6 +199,47 @@ namespace nugethost.Migrations
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("nuget_host.Data.Package", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("OwnerId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("OwnerId");
b.ToTable("Packages");
});
modelBuilder.Entity("nuget_host.Data.PackageVersion", b =>
{
b.Property<string>("FullString")
.ValueGeneratedOnAdd()
.HasMaxLength(32);
b.Property<bool>("IsPrerelease");
b.Property<int>("Major");
b.Property<int>("Minor");
b.Property<string>("PackageId")
.IsRequired();
b.Property<int>("Patch");
b.HasKey("FullString");
b.HasIndex("PackageId");
b.ToTable("PackageVersions");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
@ -209,7 +250,7 @@ namespace nugethost.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@ -217,7 +258,7 @@ namespace nugethost.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@ -230,7 +271,7 @@ namespace nugethost.Migrations
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@ -238,19 +279,35 @@ namespace nugethost.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser")
b.HasOne("nuget_host.Data.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("nuget_host.Models.ApiKeys.ApiKey", b =>
modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b =>
{
b.HasOne("nuget_host.Models.ApplicationUser", "User")
b.HasOne("nuget_host.Data.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("nuget_host.Data.Package", b =>
{
b.HasOne("nuget_host.Data.ApplicationUser", "Owner")
.WithMany()
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("nuget_host.Data.PackageVersion", b =>
{
b.HasOne("nuget_host.Data.Package", "Package")
.WithMany()
.HasForeignKey("PackageId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}