diff --git a/FoodPicker.Infrastructure/Data/MealVoteRepository.cs b/FoodPicker.Infrastructure/Data/MealVoteRepository.cs index d27e3a4..1b54982 100644 --- a/FoodPicker.Infrastructure/Data/MealVoteRepository.cs +++ b/FoodPicker.Infrastructure/Data/MealVoteRepository.cs @@ -23,7 +23,7 @@ public IEnumerable GetVotesForWeekAsEnumerable(MealWeek week) public async Task> GetUserVotesForWeekAsync(MealWeek week, string userId, CancellationToken cancellationToken = default) { - return await _db.MealVotes.Where(x => x.UserId == userId && x.Meal.MealWeekId == week.Id && x.VoteOption != null) + return await _db.MealVotes.Where(x => x.UserId == userId && x.Meal.MealWeekId == week.Id) .ToListAsync(cancellationToken); } diff --git a/FoodPicker.Infrastructure/Models/MealVote.cs b/FoodPicker.Infrastructure/Models/MealVote.cs index 15a2bc9..922e0ab 100644 --- a/FoodPicker.Infrastructure/Models/MealVote.cs +++ b/FoodPicker.Infrastructure/Models/MealVote.cs @@ -12,15 +12,8 @@ public class MealVote : BaseEntity public string UserId { get; set; } public ApplicationUser User { get; set; } - public int VoteOptionId { get; set; } + public int? VoteOptionId { get; set; } public VoteOption VoteOption { get; set; } public string Comment { get; set; } } - - public enum MealVoteOption - { - Yes = 1, - Maybe = 2, - No = 3 - } } \ No newline at end of file diff --git a/FoodPicker.Migrations/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs b/FoodPicker.Migrations/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs deleted file mode 100644 index b883e8f..0000000 --- a/FoodPicker.Migrations/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs +++ /dev/null @@ -1,272 +0,0 @@ -// - -using System; -using FoodPicker.Infrastructure.Data; -using FoodPicker.Web.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("00000000000000_CreateIdentitySchema")] - partial class CreateIdentitySchema - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.0.0"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property("NormalizedName") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property("NormalizedUserName") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasColumnType("TEXT") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT") - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasColumnType("TEXT") - .HasMaxLength(128); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT") - .HasMaxLength(128); - - b.Property("Name") - .HasColumnType("TEXT") - .HasMaxLength(128); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} \ No newline at end of file diff --git a/FoodPicker.Migrations/Data/Migrations/00000000000000_CreateIdentitySchema.cs b/FoodPicker.Migrations/Data/Migrations/00000000000000_CreateIdentitySchema.cs deleted file mode 100644 index 87a8d86..0000000 --- a/FoodPicker.Migrations/Data/Migrations/00000000000000_CreateIdentitySchema.cs +++ /dev/null @@ -1,211 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class CreateIdentitySchema : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 256, nullable: true), - NormalizedName = table.Column(maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(nullable: true) - }, - constraints: table => { table.PrimaryKey("PK_AspNetRoles", x => x.Id); }); - - migrationBuilder.CreateTable( - name: "AspNetUsers", - columns: table => new - { - Id = table.Column(nullable: false), - UserName = table.Column(maxLength: 256, nullable: true), - NormalizedUserName = table.Column(maxLength: 256, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), - EmailConfirmed = table.Column(nullable: false), - PasswordHash = table.Column(nullable: true), - SecurityStamp = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - PhoneNumber = table.Column(nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false), - TwoFactorEnabled = table.Column(nullable: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false), - AccessFailedCount = table.Column(nullable: false) - }, - constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - RoleId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(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(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(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(maxLength: 128, nullable: false), - ProviderKey = table.Column(maxLength: 128, nullable: false), - ProviderDisplayName = table.Column(nullable: true), - UserId = table.Column(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(nullable: false), - RoleId = table.Column(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(nullable: false), - LoginProvider = table.Column(maxLength: 128, nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(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); - } - - 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"); - } - } -} \ No newline at end of file diff --git a/FoodPicker.Migrations/Data/Migrations/20210628132617_More changes to weeks.Designer.cs b/FoodPicker.Migrations/Data/Migrations/20210628132617_More changes to weeks.Designer.cs deleted file mode 100644 index 80cb47b..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210628132617_More changes to weeks.Designer.cs +++ /dev/null @@ -1,334 +0,0 @@ -// -using System; -using FoodPicker.Infrastructure.Data; -using FoodPicker.Web.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20210628132617_More changes to weeks")] - partial class Morechangestoweeks - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.2"); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ImageUrl") - .HasColumnType("TEXT"); - - b.Property("MealWeekId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Tags") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealWeekId"); - - b.ToTable("Meals"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DeliveryDate") - .HasColumnType("TEXT"); - - b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MealWeeks"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "MealWeek") - .WithMany("Meals") - .HasForeignKey("MealWeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MealWeek"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Navigation("Meals"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210628132617_More changes to weeks.cs b/FoodPicker.Migrations/Data/Migrations/20210628132617_More changes to weeks.cs deleted file mode 100644 index 3b9607e..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210628132617_More changes to weeks.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class Morechangestoweeks : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "MealWeeks", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - DeliveryDate = table.Column(type: "TEXT", nullable: false), - MealWeekStatus = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_MealWeeks", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Meals", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - MealWeekId = table.Column(type: "INTEGER", nullable: false), - Name = table.Column(type: "TEXT", nullable: false), - Tags = table.Column(type: "TEXT", nullable: true), - Description = table.Column(type: "TEXT", nullable: false), - ImageUrl = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Meals", x => x.Id); - table.ForeignKey( - name: "FK_Meals_MealWeeks_MealWeekId", - column: x => x.MealWeekId, - principalTable: "MealWeeks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Meals_MealWeekId", - table: "Meals", - column: "MealWeekId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Meals"); - - migrationBuilder.DropTable( - name: "MealWeeks"); - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210628143827_Add votes.Designer.cs b/FoodPicker.Migrations/Data/Migrations/20210628143827_Add votes.Designer.cs deleted file mode 100644 index e3481ba..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210628143827_Add votes.Designer.cs +++ /dev/null @@ -1,375 +0,0 @@ -// -using System; -using FoodPicker.Infrastructure.Data; -using FoodPicker.Web.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20210628143827_Add votes")] - partial class Addvotes - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.2"); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ImageUrl") - .HasColumnType("TEXT"); - - b.Property("MealWeekId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Tags") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealWeekId"); - - b.ToTable("Meals"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .HasColumnType("TEXT"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("VoteOption") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("MealId"); - - b.ToTable("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DeliveryDate") - .HasColumnType("TEXT"); - - b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MealWeeks"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "MealWeek") - .WithMany("Meals") - .HasForeignKey("MealWeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MealWeek"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithMany("MealVotes") - .HasForeignKey("MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Navigation("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Navigation("Meals"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210628143827_Add votes.cs b/FoodPicker.Migrations/Data/Migrations/20210628143827_Add votes.cs deleted file mode 100644 index 498b9ac..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210628143827_Add votes.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class Addvotes : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "MealVotes", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - MealId = table.Column(type: "INTEGER", nullable: false), - UserId = table.Column(type: "TEXT", nullable: true), - VoteOption = table.Column(type: "INTEGER", nullable: false), - Comment = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_MealVotes", x => x.Id); - table.ForeignKey( - name: "FK_MealVotes_Meals_MealId", - column: x => x.MealId, - principalTable: "Meals", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_MealVotes_MealId", - table: "MealVotes", - column: "MealId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "MealVotes"); - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210628150607_Nullable votes.Designer.cs b/FoodPicker.Migrations/Data/Migrations/20210628150607_Nullable votes.Designer.cs deleted file mode 100644 index 8a3e580..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210628150607_Nullable votes.Designer.cs +++ /dev/null @@ -1,375 +0,0 @@ -// -using System; -using FoodPicker.Infrastructure.Data; -using FoodPicker.Web.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20210628150607_Nullable votes")] - partial class Nullablevotes - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.2"); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ImageUrl") - .HasColumnType("TEXT"); - - b.Property("MealWeekId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Tags") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealWeekId"); - - b.ToTable("Meals"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .HasColumnType("TEXT"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("VoteOption") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("MealId"); - - b.ToTable("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DeliveryDate") - .HasColumnType("TEXT"); - - b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MealWeeks"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(128) - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "MealWeek") - .WithMany("Meals") - .HasForeignKey("MealWeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MealWeek"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithMany("MealVotes") - .HasForeignKey("MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Navigation("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Navigation("Meals"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210628150607_Nullable votes.cs b/FoodPicker.Migrations/Data/Migrations/20210628150607_Nullable votes.cs deleted file mode 100644 index a7950f8..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210628150607_Nullable votes.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class Nullablevotes : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "VoteOption", - table: "MealVotes", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "VoteOption", - table: "MealVotes", - type: "INTEGER", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210629145643_Selection and Ratings.Designer.cs b/FoodPicker.Migrations/Data/Migrations/20210629145643_Selection and Ratings.Designer.cs deleted file mode 100644 index f608646..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210629145643_Selection and Ratings.Designer.cs +++ /dev/null @@ -1,410 +0,0 @@ -// -using System; -using FoodPicker.Infrastructure.Data; -using FoodPicker.Web.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20210629145643_Selection and Ratings")] - partial class SelectionandRatings - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.2"); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ImageUrl") - .HasColumnType("TEXT"); - - b.Property("MealWeekId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SelectedForOrder") - .HasColumnType("INTEGER"); - - b.Property("Tags") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealWeekId"); - - b.ToTable("Meals"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("Rating") - .HasColumnType("INTEGER"); - - b.Property("RatingComment") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealId") - .IsUnique(); - - b.ToTable("MealRating"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .HasColumnType("TEXT"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("VoteOption") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("MealId"); - - b.ToTable("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DeliveryDate") - .HasColumnType("TEXT"); - - b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MealWeeks"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "MealWeek") - .WithMany("Meals") - .HasForeignKey("MealWeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MealWeek"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithOne("MealRating") - .HasForeignKey("FoodPicker.Infrastructure.Models.MealRating", "MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithMany("MealVotes") - .HasForeignKey("MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Navigation("MealRating"); - - b.Navigation("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Navigation("Meals"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210629145643_Selection and Ratings.cs b/FoodPicker.Migrations/Data/Migrations/20210629145643_Selection and Ratings.cs deleted file mode 100644 index 7b60d39..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210629145643_Selection and Ratings.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class SelectionandRatings : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "SelectedForOrder", - table: "Meals", - type: "INTEGER", - nullable: true); - - migrationBuilder.CreateTable( - name: "MealRating", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - MealId = table.Column(type: "INTEGER", nullable: false), - Rating = table.Column(type: "INTEGER", nullable: false), - RatingComment = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_MealRating", x => x.Id); - table.ForeignKey( - name: "FK_MealRating_Meals_MealId", - column: x => x.MealId, - principalTable: "Meals", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_MealRating_MealId", - table: "MealRating", - column: "MealId", - unique: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "MealRating"); - - migrationBuilder.DropColumn( - name: "SelectedForOrder", - table: "Meals"); - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210630134812_Ratings.Designer.cs b/FoodPicker.Migrations/Data/Migrations/20210630134812_Ratings.Designer.cs deleted file mode 100644 index 5869409..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210630134812_Ratings.Designer.cs +++ /dev/null @@ -1,413 +0,0 @@ -// -using System; -using FoodPicker.Infrastructure.Data; -using FoodPicker.Web.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20210630134812_Ratings")] - partial class Ratings - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.2"); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ImageUrl") - .HasColumnType("TEXT"); - - b.Property("MealWeekId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SelectedForOrder") - .HasColumnType("INTEGER"); - - b.Property("Tags") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealWeekId"); - - b.ToTable("Meals"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("Rating") - .HasColumnType("INTEGER"); - - b.Property("RatingComment") - .HasColumnType("TEXT"); - - b.Property("RatingTime") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealId") - .IsUnique(); - - b.ToTable("MealRatings"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .HasColumnType("TEXT"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("VoteOption") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("MealId"); - - b.ToTable("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DeliveryDate") - .HasColumnType("TEXT"); - - b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MealWeeks"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "MealWeek") - .WithMany("Meals") - .HasForeignKey("MealWeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MealWeek"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithOne("MealRating") - .HasForeignKey("FoodPicker.Infrastructure.Models.MealRating", "MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithMany("MealVotes") - .HasForeignKey("MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Navigation("MealRating"); - - b.Navigation("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Navigation("Meals"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210630134812_Ratings.cs b/FoodPicker.Migrations/Data/Migrations/20210630134812_Ratings.cs deleted file mode 100644 index 3859a55..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210630134812_Ratings.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class Ratings : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_MealRating_Meals_MealId", - table: "MealRating"); - - migrationBuilder.DropPrimaryKey( - name: "PK_MealRating", - table: "MealRating"); - - migrationBuilder.RenameTable( - name: "MealRating", - newName: "MealRatings"); - - migrationBuilder.RenameIndex( - name: "IX_MealRating_MealId", - table: "MealRatings", - newName: "IX_MealRatings_MealId"); - - migrationBuilder.AddColumn( - name: "RatingTime", - table: "MealRatings", - type: "TEXT", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AddPrimaryKey( - name: "PK_MealRatings", - table: "MealRatings", - column: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_MealRatings_Meals_MealId", - table: "MealRatings", - column: "MealId", - principalTable: "Meals", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_MealRatings_Meals_MealId", - table: "MealRatings"); - - migrationBuilder.DropPrimaryKey( - name: "PK_MealRatings", - table: "MealRatings"); - - migrationBuilder.DropColumn( - name: "RatingTime", - table: "MealRatings"); - - migrationBuilder.RenameTable( - name: "MealRatings", - newName: "MealRating"); - - migrationBuilder.RenameIndex( - name: "IX_MealRatings_MealId", - table: "MealRating", - newName: "IX_MealRating_MealId"); - - migrationBuilder.AddPrimaryKey( - name: "PK_MealRating", - table: "MealRating", - column: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_MealRating_Meals_MealId", - table: "MealRating", - column: "MealId", - principalTable: "Meals", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210808171813_Optional voters.Designer.cs b/FoodPicker.Migrations/Data/Migrations/20210808171813_Optional voters.Designer.cs deleted file mode 100644 index 12414dd..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210808171813_Optional voters.Designer.cs +++ /dev/null @@ -1,424 +0,0 @@ -// -using System; -using FoodPicker.Infrastructure.Data; -using FoodPicker.Web.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20210808171813_Optional voters")] - partial class Optionalvoters - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.7"); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("VoteIsRequired") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ImageUrl") - .HasColumnType("TEXT"); - - b.Property("MealWeekId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SelectedForOrder") - .HasColumnType("INTEGER"); - - b.Property("Tags") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealWeekId"); - - b.ToTable("Meals"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("Rating") - .HasColumnType("INTEGER"); - - b.Property("RatingComment") - .HasColumnType("TEXT"); - - b.Property("RatingTime") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealId") - .IsUnique(); - - b.ToTable("MealRatings"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .HasColumnType("TEXT"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("VoteOption") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("MealId"); - - b.HasIndex("UserId"); - - b.ToTable("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DeliveryDate") - .HasColumnType("TEXT"); - - b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MealWeeks"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "MealWeek") - .WithMany("Meals") - .HasForeignKey("MealWeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MealWeek"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithOne("MealRating") - .HasForeignKey("FoodPicker.Infrastructure.Models.MealRating", "MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithMany("MealVotes") - .HasForeignKey("MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Meal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Navigation("MealRating"); - - b.Navigation("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Navigation("Meals"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210808171813_Optional voters.cs b/FoodPicker.Migrations/Data/Migrations/20210808171813_Optional voters.cs deleted file mode 100644 index d62e09d..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210808171813_Optional voters.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class Optionalvoters : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "VoteIsRequired", - table: "AspNetUsers", - type: "INTEGER", - nullable: false, - defaultValue: true); - - migrationBuilder.CreateIndex( - name: "IX_MealVotes_UserId", - table: "MealVotes", - column: "UserId"); - - migrationBuilder.AddForeignKey( - name: "FK_MealVotes_AspNetUsers_UserId", - table: "MealVotes", - column: "UserId", - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_MealVotes_AspNetUsers_UserId", - table: "MealVotes"); - - migrationBuilder.DropIndex( - name: "IX_MealVotes_UserId", - table: "MealVotes"); - - migrationBuilder.DropColumn( - name: "VoteIsRequired", - table: "AspNetUsers"); - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210919134337_VoteOption Create.Designer.cs b/FoodPicker.Migrations/Data/Migrations/20210919134337_VoteOption Create.Designer.cs deleted file mode 100644 index 8b3b6fb..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210919134337_VoteOption Create.Designer.cs +++ /dev/null @@ -1,440 +0,0 @@ -// -using System; -using FoodPicker.Infrastructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20210919134337_VoteOption Create")] - partial class VoteOptionCreate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.10"); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("VoteIsRequired") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ImageUrl") - .HasColumnType("TEXT"); - - b.Property("MealWeekId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SelectedForOrder") - .HasColumnType("INTEGER"); - - b.Property("Tags") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealWeekId"); - - b.ToTable("Meals"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("Rating") - .HasColumnType("INTEGER"); - - b.Property("RatingComment") - .HasColumnType("TEXT"); - - b.Property("RatingTime") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealId") - .IsUnique(); - - b.ToTable("MealRatings"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .HasColumnType("TEXT"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("VoteOption") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("MealId"); - - b.HasIndex("UserId"); - - b.ToTable("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DeliveryDate") - .HasColumnType("TEXT"); - - b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MealWeeks"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.VoteOption", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Weight") - .HasColumnType("REAL"); - - b.HasKey("Id"); - - b.ToTable("VoteOptions"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "MealWeek") - .WithMany("Meals") - .HasForeignKey("MealWeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MealWeek"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithOne("MealRating") - .HasForeignKey("FoodPicker.Infrastructure.Models.MealRating", "MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithMany("MealVotes") - .HasForeignKey("MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Meal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Navigation("MealRating"); - - b.Navigation("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Navigation("Meals"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210919134337_VoteOption Create.cs b/FoodPicker.Migrations/Data/Migrations/20210919134337_VoteOption Create.cs deleted file mode 100644 index cf8fdfb..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210919134337_VoteOption Create.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class VoteOptionCreate : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "VoteOptions", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: true), - Weight = table.Column(type: "REAL", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_VoteOptions", x => x.Id); - }); - - - migrationBuilder.RenameColumn("VoteOption", "MealVotes", "VoteOptionId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "VoteOptions"); - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20210919135426_VoteOption Initialize Data.Designer.cs b/FoodPicker.Migrations/Data/Migrations/20210919135426_VoteOption Initialize Data.Designer.cs deleted file mode 100644 index c3544db..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20210919135426_VoteOption Initialize Data.Designer.cs +++ /dev/null @@ -1,440 +0,0 @@ -// -using System; -using FoodPicker.Infrastructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20210919135426_VoteOption Initialize Data")] - partial class VoteOptionInitializeData - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.10"); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("VoteIsRequired") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ImageUrl") - .HasColumnType("TEXT"); - - b.Property("MealWeekId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SelectedForOrder") - .HasColumnType("INTEGER"); - - b.Property("Tags") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealWeekId"); - - b.ToTable("Meals"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("Rating") - .HasColumnType("INTEGER"); - - b.Property("RatingComment") - .HasColumnType("TEXT"); - - b.Property("RatingTime") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealId") - .IsUnique(); - - b.ToTable("MealRatings"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .HasColumnType("TEXT"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("VoteOption") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("MealId"); - - b.HasIndex("UserId"); - - b.ToTable("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DeliveryDate") - .HasColumnType("TEXT"); - - b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MealWeeks"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.VoteOption", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Weight") - .HasColumnType("REAL"); - - b.HasKey("Id"); - - b.ToTable("VoteOptions"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "MealWeek") - .WithMany("Meals") - .HasForeignKey("MealWeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MealWeek"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithOne("MealRating") - .HasForeignKey("FoodPicker.Infrastructure.Models.MealRating", "MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithMany("MealVotes") - .HasForeignKey("MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("Meal"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Navigation("MealRating"); - - b.Navigation("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Navigation("Meals"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20211002133905_Add Week User Comments.Designer.cs b/FoodPicker.Migrations/Data/Migrations/20211002133905_Add Week User Comments.Designer.cs deleted file mode 100644 index 8f9bdb9..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20211002133905_Add Week User Comments.Designer.cs +++ /dev/null @@ -1,493 +0,0 @@ -// -using System; -using FoodPicker.Infrastructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20211002133905_Add Week User Comments")] - partial class AddWeekUserComments - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.10"); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("VoteIsRequired") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ImageUrl") - .HasColumnType("TEXT"); - - b.Property("MealWeekId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SelectedForOrder") - .HasColumnType("INTEGER"); - - b.Property("Tags") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealWeekId"); - - b.ToTable("Meals"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("Rating") - .HasColumnType("INTEGER"); - - b.Property("RatingComment") - .HasColumnType("TEXT"); - - b.Property("RatingTime") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealId") - .IsUnique(); - - b.ToTable("MealRatings"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .HasColumnType("TEXT"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("VoteOptionId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("MealId"); - - b.HasIndex("UserId"); - - b.HasIndex("VoteOptionId"); - - b.ToTable("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DeliveryDate") - .HasColumnType("TEXT"); - - b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MealWeeks"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.VoteOption", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Weight") - .HasColumnType("REAL"); - - b.HasKey("Id"); - - b.ToTable("VoteOptions"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.WeekUserComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("WeekId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.HasIndex("WeekId"); - - b.ToTable("WeekUserComments"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "MealWeek") - .WithMany("Meals") - .HasForeignKey("MealWeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MealWeek"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithOne("MealRating") - .HasForeignKey("FoodPicker.Infrastructure.Models.MealRating", "MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithMany("MealVotes") - .HasForeignKey("MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.HasOne("FoodPicker.Infrastructure.Models.VoteOption", "VoteOption") - .WithMany() - .HasForeignKey("VoteOptionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - - b.Navigation("User"); - - b.Navigation("VoteOption"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.WeekUserComment", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "Week") - .WithMany() - .HasForeignKey("WeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - - b.Navigation("Week"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Navigation("MealRating"); - - b.Navigation("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Navigation("Meals"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20211002133905_Add Week User Comments.cs b/FoodPicker.Migrations/Data/Migrations/20211002133905_Add Week User Comments.cs deleted file mode 100644 index f7143b4..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20211002133905_Add Week User Comments.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class AddWeekUserComments : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "WeekUserComments", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column(type: "TEXT", nullable: true), - WeekId = table.Column(type: "INTEGER", nullable: false), - Comment = table.Column(type: "TEXT", maxLength: 1000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_WeekUserComments", x => x.Id); - table.ForeignKey( - name: "FK_WeekUserComments_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_WeekUserComments_MealWeeks_WeekId", - column: x => x.WeekId, - principalTable: "MealWeeks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_WeekUserComments_UserId", - table: "WeekUserComments", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_WeekUserComments_WeekId", - table: "WeekUserComments", - column: "WeekId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "WeekUserComments"); - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20211209181401_Add Persistent Config.Designer.cs b/FoodPicker.Migrations/Data/Migrations/20211209181401_Add Persistent Config.Designer.cs deleted file mode 100644 index 95c3db8..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20211209181401_Add Persistent Config.Designer.cs +++ /dev/null @@ -1,513 +0,0 @@ -// -using System; -using FoodPicker.Infrastructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20211209181401_Add Persistent Config")] - partial class AddPersistentConfig - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.10"); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("VoteIsRequired") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ImageUrl") - .HasColumnType("TEXT"); - - b.Property("MealWeekId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SelectedForOrder") - .HasColumnType("INTEGER"); - - b.Property("Tags") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealWeekId"); - - b.ToTable("Meals"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("Rating") - .HasColumnType("INTEGER"); - - b.Property("RatingComment") - .HasColumnType("TEXT"); - - b.Property("RatingTime") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealId") - .IsUnique(); - - b.ToTable("MealRatings"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .HasColumnType("TEXT"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("VoteOptionId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("MealId"); - - b.HasIndex("UserId"); - - b.HasIndex("VoteOptionId"); - - b.ToTable("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DeliveryDate") - .HasColumnType("TEXT"); - - b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MealWeeks"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.PersistentConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConfigCode") - .HasColumnType("TEXT"); - - b.Property("PersistentConfigId") - .HasColumnType("INTEGER"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("PersistentConfigs"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.VoteOption", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Weight") - .HasColumnType("REAL"); - - b.HasKey("Id"); - - b.ToTable("VoteOptions"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.WeekUserComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("WeekId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.HasIndex("WeekId"); - - b.ToTable("WeekUserComments"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "MealWeek") - .WithMany("Meals") - .HasForeignKey("MealWeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MealWeek"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithOne("MealRating") - .HasForeignKey("FoodPicker.Infrastructure.Models.MealRating", "MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithMany("MealVotes") - .HasForeignKey("MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.HasOne("FoodPicker.Infrastructure.Models.VoteOption", "VoteOption") - .WithMany() - .HasForeignKey("VoteOptionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - - b.Navigation("User"); - - b.Navigation("VoteOption"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.WeekUserComment", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "Week") - .WithMany() - .HasForeignKey("WeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - - b.Navigation("Week"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Navigation("MealRating"); - - b.Navigation("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Navigation("Meals"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20211209181401_Add Persistent Config.cs b/FoodPicker.Migrations/Data/Migrations/20211209181401_Add Persistent Config.cs deleted file mode 100644 index 394b5f8..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20211209181401_Add Persistent Config.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class AddPersistentConfig : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "PersistentConfigs", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ConfigCode = table.Column(type: "TEXT", nullable: true), - Value = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PersistentConfigs", x => x.Id); - }); - - migrationBuilder.InsertData("PersistentConfigs", "ConfigCode", "HelloFreshRefreshToken"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "PersistentConfigs"); - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20220717000253_Add name to user.Designer.cs b/FoodPicker.Migrations/Data/Migrations/20220717000253_Add name to user.Designer.cs deleted file mode 100644 index 3de3e19..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20220717000253_Add name to user.Designer.cs +++ /dev/null @@ -1,514 +0,0 @@ -// -using System; -using FoodPicker.Infrastructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20220717000253_Add name to user")] - partial class Addnametouser - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.10"); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("VoteIsRequired") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ImageUrl") - .HasColumnType("TEXT"); - - b.Property("MealWeekId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SelectedForOrder") - .HasColumnType("INTEGER"); - - b.Property("Tags") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealWeekId"); - - b.ToTable("Meals"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("Rating") - .HasColumnType("INTEGER"); - - b.Property("RatingComment") - .HasColumnType("TEXT"); - - b.Property("RatingTime") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealId") - .IsUnique(); - - b.ToTable("MealRatings"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .HasColumnType("TEXT"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("VoteOptionId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("MealId"); - - b.HasIndex("UserId"); - - b.HasIndex("VoteOptionId"); - - b.ToTable("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DeliveryDate") - .HasColumnType("TEXT"); - - b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MealWeeks"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.PersistentConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConfigCode") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("PersistentConfigs"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.VoteOption", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Weight") - .HasColumnType("REAL"); - - b.HasKey("Id"); - - b.ToTable("VoteOptions"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.WeekUserComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("WeekId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.HasIndex("WeekId"); - - b.ToTable("WeekUserComments"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "MealWeek") - .WithMany("Meals") - .HasForeignKey("MealWeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MealWeek"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithOne("MealRating") - .HasForeignKey("FoodPicker.Infrastructure.Models.MealRating", "MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithMany("MealVotes") - .HasForeignKey("MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.HasOne("FoodPicker.Infrastructure.Models.VoteOption", "VoteOption") - .WithMany() - .HasForeignKey("VoteOptionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - - b.Navigation("User"); - - b.Navigation("VoteOption"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.WeekUserComment", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "Week") - .WithMany() - .HasForeignKey("WeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - - b.Navigation("Week"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Navigation("MealRating"); - - b.Navigation("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Navigation("Meals"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20220717000253_Add name to user.cs b/FoodPicker.Migrations/Data/Migrations/20220717000253_Add name to user.cs deleted file mode 100644 index ee674c7..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20220717000253_Add name to user.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class Addnametouser : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Name", - table: "AspNetUsers", - type: "TEXT", - nullable: true, - defaultValue: ""); - migrationBuilder.Sql("UPDATE AspNetUsers SET Name = UserName"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Name", - table: "AspNetUsers"); - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20220825205505_Add URL to Meal.Designer.cs b/FoodPicker.Migrations/Data/Migrations/20220825205505_Add URL to Meal.Designer.cs deleted file mode 100644 index 0afb7ea..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20220825205505_Add URL to Meal.Designer.cs +++ /dev/null @@ -1,517 +0,0 @@ -// -using System; -using FoodPicker.Infrastructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace FoodPicker.Web.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20220825205505_Add URL to Meal")] - partial class AddURLtoMeal - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.10"); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.ApplicationUser", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("VoteIsRequired") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Description") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ImageUrl") - .HasColumnType("TEXT"); - - b.Property("MealWeekId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("SelectedForOrder") - .HasColumnType("INTEGER"); - - b.Property("Tags") - .HasColumnType("TEXT"); - - b.Property("Url") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealWeekId"); - - b.ToTable("Meals"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("Rating") - .HasColumnType("INTEGER"); - - b.Property("RatingComment") - .HasColumnType("TEXT"); - - b.Property("RatingTime") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("MealId") - .IsUnique(); - - b.ToTable("MealRatings"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .HasColumnType("TEXT"); - - b.Property("MealId") - .HasColumnType("INTEGER"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("VoteOptionId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("MealId"); - - b.HasIndex("UserId"); - - b.HasIndex("VoteOptionId"); - - b.ToTable("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DeliveryDate") - .HasColumnType("TEXT"); - - b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("MealWeeks"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.PersistentConfig", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConfigCode") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("PersistentConfigs"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.VoteOption", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Weight") - .HasColumnType("REAL"); - - b.HasKey("Id"); - - b.ToTable("VoteOptions"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.WeekUserComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Comment") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("WeekId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.HasIndex("WeekId"); - - b.ToTable("WeekUserComments"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "MealWeek") - .WithMany("Meals") - .HasForeignKey("MealWeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MealWeek"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealRating", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithOne("MealRating") - .HasForeignKey("FoodPicker.Infrastructure.Models.MealRating", "MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealVote", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.Meal", "Meal") - .WithMany("MealVotes") - .HasForeignKey("MealId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.HasOne("FoodPicker.Infrastructure.Models.VoteOption", "VoteOption") - .WithMany() - .HasForeignKey("VoteOptionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Meal"); - - b.Navigation("User"); - - b.Navigation("VoteOption"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.WeekUserComment", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.HasOne("FoodPicker.Infrastructure.Models.MealWeek", "Week") - .WithMany() - .HasForeignKey("WeekId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - - b.Navigation("Week"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("FoodPicker.Infrastructure.Models.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.Meal", b => - { - b.Navigation("MealRating"); - - b.Navigation("MealVotes"); - }); - - modelBuilder.Entity("FoodPicker.Infrastructure.Models.MealWeek", b => - { - b.Navigation("Meals"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20220825205505_Add URL to Meal.cs b/FoodPicker.Migrations/Data/Migrations/20220825205505_Add URL to Meal.cs deleted file mode 100644 index fa5d0e7..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20220825205505_Add URL to Meal.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class AddURLtoMeal : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Url", - table: "Meals", - type: "TEXT", - nullable: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Url", - table: "Meals"); - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20220908190130_AutoVote.cs b/FoodPicker.Migrations/Data/Migrations/20220908190130_AutoVote.cs deleted file mode 100644 index 5ef1811..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20220908190130_AutoVote.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class AutoVote : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AutoVotes", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Keyword = table.Column(type: "TEXT", nullable: true), - VoteOptionId = table.Column(type: "INTEGER", nullable: false), - UserId = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AutoVotes", x => x.Id); - table.ForeignKey( - name: "FK_AutoVotes_VoteOptions_VoteOptionId", - column: x => x.VoteOptionId, - principalTable: "VoteOptions", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AutoVotes_VoteOptionId", - table: "AutoVotes", - column: "VoteOptionId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AutoVotes"); - } - } -} diff --git a/FoodPicker.Migrations/Data/Migrations/20221013204726_Unique MealVotes.cs b/FoodPicker.Migrations/Data/Migrations/20221013204726_Unique MealVotes.cs deleted file mode 100644 index 69a4d50..0000000 --- a/FoodPicker.Migrations/Data/Migrations/20221013204726_Unique MealVotes.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace FoodPicker.Web.Data.Migrations -{ - public partial class UniqueMealVotes : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.Sql("delete from MealVotes where Id not in (select max(Id) from MealVotes group by MealId, UserId)"); - - migrationBuilder.DropIndex( - name: "IX_MealVotes_MealId", - table: "MealVotes"); - - migrationBuilder.CreateIndex( - name: "IX_MealVotes_MealId_UserId", - table: "MealVotes", - columns: new[] { "MealId", "UserId" }, - unique: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_MealVotes_MealId_UserId", - table: "MealVotes"); - - migrationBuilder.CreateIndex( - name: "IX_MealVotes_MealId", - table: "MealVotes", - column: "MealId"); - } - } -} diff --git a/FoodPicker.Migrations/FoodPicker.Migrations.csproj b/FoodPicker.Migrations/FoodPicker.Migrations.csproj index d5b68de..2eeacff 100644 --- a/FoodPicker.Migrations/FoodPicker.Migrations.csproj +++ b/FoodPicker.Migrations/FoodPicker.Migrations.csproj @@ -5,10 +5,7 @@ - - - - + all diff --git a/FoodPicker.Migrations/Data/Migrations/20220908190130_AutoVote.Designer.cs b/FoodPicker.Migrations/Migrations/20230824130710_Initial Migrtion.Designer.cs similarity index 76% rename from FoodPicker.Migrations/Data/Migrations/20220908190130_AutoVote.Designer.cs rename to FoodPicker.Migrations/Migrations/20230824130710_Initial Migrtion.Designer.cs index 0e89a80..0be2b13 100644 --- a/FoodPicker.Migrations/Data/Migrations/20220908190130_AutoVote.Designer.cs +++ b/FoodPicker.Migrations/Migrations/20230824130710_Initial Migrtion.Designer.cs @@ -6,76 +6,79 @@ using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace FoodPicker.Web.Data.Migrations +#nullable disable + +namespace FoodPicker.Migrations.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20220908190130_AutoVote")] - partial class AutoVote + [Migration("20230824130710_Initial Migrtion")] + partial class InitialMigrtion { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "5.0.17"); + .HasAnnotation("ProductVersion", "6.0.21") + .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("FoodPicker.Infrastructure.Models.ApplicationUser", b => { b.Property("Id") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Email") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("LockoutEnd") - .HasColumnType("TEXT"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("NormalizedEmail") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("NormalizedUserName") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("PasswordHash") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("PhoneNumber") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("SecurityStamp") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("UserName") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("VoteIsRequired") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.HasKey("Id"); @@ -86,23 +89,23 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("UserNameIndex"); - b.ToTable("AspNetUsers"); + b.ToTable("AspNetUsers", (string)null); }); modelBuilder.Entity("FoodPicker.Infrastructure.Models.AutoVote", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Keyword") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("VoteOptionId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("Id"); @@ -115,30 +118,30 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Description") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("ImageUrl") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("MealWeekId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Name") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("SelectedForOrder") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("Tags") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Url") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("Id"); @@ -151,19 +154,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("MealId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Rating") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("RatingComment") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("RatingTime") - .HasColumnType("TEXT"); + .HasColumnType("datetime(6)"); b.HasKey("Id"); @@ -177,28 +180,29 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Comment") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("MealId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("VoteOptionId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("Id"); - b.HasIndex("MealId"); - b.HasIndex("UserId"); b.HasIndex("VoteOptionId"); + b.HasIndex("MealId", "UserId") + .IsUnique(); + b.ToTable("MealVotes"); }); @@ -206,13 +210,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("DeliveryDate") - .HasColumnType("TEXT"); + .HasColumnType("datetime(6)"); b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("Id"); @@ -223,13 +227,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("ConfigCode") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Value") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("Id"); @@ -240,13 +244,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Weight") - .HasColumnType("REAL"); + .HasColumnType("double"); b.HasKey("Id"); @@ -257,18 +261,18 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Comment") .IsRequired() .HasMaxLength(1000) - .HasColumnType("TEXT"); + .HasColumnType("varchar(1000)"); b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("WeekId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("Id"); @@ -282,19 +286,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property("Id") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Name") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("NormalizedName") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.HasKey("Id"); @@ -302,109 +306,109 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("RoleNameIndex"); - b.ToTable("AspNetRoles"); + b.ToTable("AspNetRoles", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("ClaimType") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("ClaimValue") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("RoleId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.HasKey("Id"); b.HasIndex("RoleId"); - b.ToTable("AspNetRoleClaims"); + b.ToTable("AspNetRoleClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("ClaimType") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("ClaimValue") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("UserId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.HasKey("Id"); b.HasIndex("UserId"); - b.ToTable("AspNetUserClaims"); + b.ToTable("AspNetUserClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("ProviderKey") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("UserId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.HasKey("LoginProvider", "ProviderKey"); b.HasIndex("UserId"); - b.ToTable("AspNetUserLogins"); + b.ToTable("AspNetUserLogins", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("RoleId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.HasKey("UserId", "RoleId"); b.HasIndex("RoleId"); - b.ToTable("AspNetUserRoles"); + b.ToTable("AspNetUserRoles", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("LoginProvider") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("Value") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AspNetUserTokens"); + b.ToTable("AspNetUserTokens", (string)null); }); modelBuilder.Entity("FoodPicker.Infrastructure.Models.AutoVote", b => diff --git a/FoodPicker.Migrations/Migrations/20230824130710_Initial Migrtion.cs b/FoodPicker.Migrations/Migrations/20230824130710_Initial Migrtion.cs new file mode 100644 index 0000000..65ccfb9 --- /dev/null +++ b/FoodPicker.Migrations/Migrations/20230824130710_Initial Migrtion.cs @@ -0,0 +1,520 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FoodPicker.Migrations.Migrations +{ + public partial class InitialMigrtion : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterDatabase() + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetRoles", + columns: table => new + { + Id = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Name = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + NormalizedName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ConcurrencyStamp = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoles", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetUsers", + columns: table => new + { + Id = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + VoteIsRequired = table.Column(type: "tinyint(1)", nullable: false), + UserName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + NormalizedUserName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Email = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + NormalizedEmail = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + EmailConfirmed = table.Column(type: "tinyint(1)", nullable: false), + PasswordHash = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + SecurityStamp = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ConcurrencyStamp = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + PhoneNumber = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + PhoneNumberConfirmed = table.Column(type: "tinyint(1)", nullable: false), + TwoFactorEnabled = table.Column(type: "tinyint(1)", nullable: false), + LockoutEnd = table.Column(type: "datetime(6)", nullable: true), + LockoutEnabled = table.Column(type: "tinyint(1)", nullable: false), + AccessFailedCount = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "MealWeeks", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DeliveryDate = table.Column(type: "datetime(6)", nullable: false), + MealWeekStatus = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MealWeeks", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "PersistentConfigs", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ConfigCode = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Value = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_PersistentConfigs", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "VoteOptions", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Weight = table.Column(type: "double", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_VoteOptions", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetRoleClaims", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RoleId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ClaimType = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ClaimValue = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + 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); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetUserClaims", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ClaimType = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ClaimValue = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + 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); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetUserLogins", + columns: table => new + { + LoginProvider = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ProviderKey = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ProviderDisplayName = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + UserId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + 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); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetUserRoles", + columns: table => new + { + UserId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + RoleId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + 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); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetUserTokens", + columns: table => new + { + UserId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + LoginProvider = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Name = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Value = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + 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); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Meals", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + MealWeekId = table.Column(type: "int", nullable: false), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Tags = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ImageUrl = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Url = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + SelectedForOrder = table.Column(type: "tinyint(1)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Meals", x => x.Id); + table.ForeignKey( + name: "FK_Meals_MealWeeks_MealWeekId", + column: x => x.MealWeekId, + principalTable: "MealWeeks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "WeekUserComments", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + WeekId = table.Column(type: "int", nullable: false), + Comment = table.Column(type: "varchar(1000)", maxLength: 1000, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_WeekUserComments", x => x.Id); + table.ForeignKey( + name: "FK_WeekUserComments_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_WeekUserComments_MealWeeks_WeekId", + column: x => x.WeekId, + principalTable: "MealWeeks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AutoVotes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Keyword = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + VoteOptionId = table.Column(type: "int", nullable: false), + UserId = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_AutoVotes", x => x.Id); + table.ForeignKey( + name: "FK_AutoVotes_VoteOptions_VoteOptionId", + column: x => x.VoteOptionId, + principalTable: "VoteOptions", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "MealRatings", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + MealId = table.Column(type: "int", nullable: false), + Rating = table.Column(type: "int", nullable: false), + RatingComment = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + RatingTime = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MealRatings", x => x.Id); + table.ForeignKey( + name: "FK_MealRatings_Meals_MealId", + column: x => x.MealId, + principalTable: "Meals", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "MealVotes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + MealId = table.Column(type: "int", nullable: false), + UserId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + VoteOptionId = table.Column(type: "int", nullable: true), + Comment = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_MealVotes", x => x.Id); + table.ForeignKey( + name: "FK_MealVotes_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_MealVotes_Meals_MealId", + column: x => x.MealId, + principalTable: "Meals", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_MealVotes_VoteOptions_VoteOptionId", + column: x => x.VoteOptionId, + principalTable: "VoteOptions", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + 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); + + migrationBuilder.CreateIndex( + name: "IX_AutoVotes_VoteOptionId", + table: "AutoVotes", + column: "VoteOptionId"); + + migrationBuilder.CreateIndex( + name: "IX_MealRatings_MealId", + table: "MealRatings", + column: "MealId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Meals_MealWeekId", + table: "Meals", + column: "MealWeekId"); + + migrationBuilder.CreateIndex( + name: "IX_MealVotes_MealId_UserId", + table: "MealVotes", + columns: new[] { "MealId", "UserId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_MealVotes_UserId", + table: "MealVotes", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_MealVotes_VoteOptionId", + table: "MealVotes", + column: "VoteOptionId"); + + migrationBuilder.CreateIndex( + name: "IX_WeekUserComments_UserId", + table: "WeekUserComments", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_WeekUserComments_WeekId", + table: "WeekUserComments", + column: "WeekId"); + } + + 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: "AutoVotes"); + + migrationBuilder.DropTable( + name: "MealRatings"); + + migrationBuilder.DropTable( + name: "MealVotes"); + + migrationBuilder.DropTable( + name: "PersistentConfigs"); + + migrationBuilder.DropTable( + name: "WeekUserComments"); + + migrationBuilder.DropTable( + name: "AspNetRoles"); + + migrationBuilder.DropTable( + name: "Meals"); + + migrationBuilder.DropTable( + name: "VoteOptions"); + + migrationBuilder.DropTable( + name: "AspNetUsers"); + + migrationBuilder.DropTable( + name: "MealWeeks"); + } + } +} diff --git a/FoodPicker.Migrations/Data/Migrations/20221013204726_Unique MealVotes.Designer.cs b/FoodPicker.Migrations/Migrations/20230824134234_Data Seeding.Designer.cs similarity index 76% rename from FoodPicker.Migrations/Data/Migrations/20221013204726_Unique MealVotes.Designer.cs rename to FoodPicker.Migrations/Migrations/20230824134234_Data Seeding.Designer.cs index 5a05130..4c8e436 100644 --- a/FoodPicker.Migrations/Data/Migrations/20221013204726_Unique MealVotes.Designer.cs +++ b/FoodPicker.Migrations/Migrations/20230824134234_Data Seeding.Designer.cs @@ -6,76 +6,79 @@ using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace FoodPicker.Web.Data.Migrations +#nullable disable + +namespace FoodPicker.Migrations.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20221013204726_Unique MealVotes")] - partial class UniqueMealVotes + [Migration("20230824134234_Data Seeding")] + partial class DataSeeding { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "5.0.17"); + .HasAnnotation("ProductVersion", "6.0.21") + .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("FoodPicker.Infrastructure.Models.ApplicationUser", b => { b.Property("Id") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Email") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("LockoutEnd") - .HasColumnType("TEXT"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("NormalizedEmail") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("NormalizedUserName") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("PasswordHash") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("PhoneNumber") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("SecurityStamp") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("UserName") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("VoteIsRequired") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.HasKey("Id"); @@ -86,23 +89,23 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("UserNameIndex"); - b.ToTable("AspNetUsers"); + b.ToTable("AspNetUsers", (string)null); }); modelBuilder.Entity("FoodPicker.Infrastructure.Models.AutoVote", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Keyword") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("VoteOptionId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("Id"); @@ -115,30 +118,30 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Description") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("ImageUrl") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("MealWeekId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Name") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("SelectedForOrder") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("Tags") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Url") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("Id"); @@ -151,19 +154,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("MealId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Rating") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("RatingComment") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("RatingTime") - .HasColumnType("TEXT"); + .HasColumnType("datetime(6)"); b.HasKey("Id"); @@ -177,19 +180,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Comment") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("MealId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("VoteOptionId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("Id"); @@ -207,13 +210,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("DeliveryDate") - .HasColumnType("TEXT"); + .HasColumnType("datetime(6)"); b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("Id"); @@ -224,13 +227,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("ConfigCode") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Value") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("Id"); @@ -241,13 +244,13 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Weight") - .HasColumnType("REAL"); + .HasColumnType("double"); b.HasKey("Id"); @@ -258,18 +261,18 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Comment") .IsRequired() .HasMaxLength(1000) - .HasColumnType("TEXT"); + .HasColumnType("varchar(1000)"); b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("WeekId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("Id"); @@ -283,19 +286,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property("Id") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Name") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("NormalizedName") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.HasKey("Id"); @@ -303,109 +306,109 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("RoleNameIndex"); - b.ToTable("AspNetRoles"); + b.ToTable("AspNetRoles", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("ClaimType") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("ClaimValue") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("RoleId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.HasKey("Id"); b.HasIndex("RoleId"); - b.ToTable("AspNetRoleClaims"); + b.ToTable("AspNetRoleClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("ClaimType") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("ClaimValue") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("UserId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.HasKey("Id"); b.HasIndex("UserId"); - b.ToTable("AspNetUserClaims"); + b.ToTable("AspNetUserClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("ProviderKey") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("UserId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.HasKey("LoginProvider", "ProviderKey"); b.HasIndex("UserId"); - b.ToTable("AspNetUserLogins"); + b.ToTable("AspNetUserLogins", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("RoleId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.HasKey("UserId", "RoleId"); b.HasIndex("RoleId"); - b.ToTable("AspNetUserRoles"); + b.ToTable("AspNetUserRoles", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("LoginProvider") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("Value") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AspNetUserTokens"); + b.ToTable("AspNetUserTokens", (string)null); }); modelBuilder.Entity("FoodPicker.Infrastructure.Models.AutoVote", b => diff --git a/FoodPicker.Migrations/Data/Migrations/20210919135426_VoteOption Initialize Data.cs b/FoodPicker.Migrations/Migrations/20230824134234_Data Seeding.cs similarity index 83% rename from FoodPicker.Migrations/Data/Migrations/20210919135426_VoteOption Initialize Data.cs rename to FoodPicker.Migrations/Migrations/20230824134234_Data Seeding.cs index 862d260..c3a60f7 100644 --- a/FoodPicker.Migrations/Data/Migrations/20210919135426_VoteOption Initialize Data.cs +++ b/FoodPicker.Migrations/Migrations/20230824134234_Data Seeding.cs @@ -1,8 +1,10 @@ using Microsoft.EntityFrameworkCore.Migrations; -namespace FoodPicker.Web.Data.Migrations +#nullable disable + +namespace FoodPicker.Migrations.Migrations { - public partial class VoteOptionInitializeData : Migration + public partial class DataSeeding : Migration { protected override void Up(MigrationBuilder migrationBuilder) { diff --git a/FoodPicker.Migrations/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/FoodPicker.Migrations/Migrations/ApplicationDbContextModelSnapshot.cs similarity index 77% rename from FoodPicker.Migrations/Data/Migrations/ApplicationDbContextModelSnapshot.cs rename to FoodPicker.Migrations/Migrations/ApplicationDbContextModelSnapshot.cs index 29a6625..b861b84 100644 --- a/FoodPicker.Migrations/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/FoodPicker.Migrations/Migrations/ApplicationDbContextModelSnapshot.cs @@ -5,7 +5,9 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace FoodPicker.Web.Data.Migrations +#nullable disable + +namespace FoodPicker.Migrations.Migrations { [DbContext(typeof(ApplicationDbContext))] partial class ApplicationDbContextModelSnapshot : ModelSnapshot @@ -14,66 +16,67 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "5.0.17"); + .HasAnnotation("ProductVersion", "6.0.21") + .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("FoodPicker.Infrastructure.Models.ApplicationUser", b => { b.Property("Id") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Email") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("LockoutEnd") - .HasColumnType("TEXT"); + .HasColumnType("datetime(6)"); b.Property("Name") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("NormalizedEmail") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("NormalizedUserName") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("PasswordHash") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("PhoneNumber") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("SecurityStamp") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("UserName") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("VoteIsRequired") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.HasKey("Id"); @@ -84,23 +87,23 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("UserNameIndex"); - b.ToTable("AspNetUsers"); + b.ToTable("AspNetUsers", (string)null); }); modelBuilder.Entity("FoodPicker.Infrastructure.Models.AutoVote", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Keyword") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("VoteOptionId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("Id"); @@ -113,30 +116,30 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Description") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("ImageUrl") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("MealWeekId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Name") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("SelectedForOrder") - .HasColumnType("INTEGER"); + .HasColumnType("tinyint(1)"); b.Property("Tags") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Url") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("Id"); @@ -149,19 +152,19 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("MealId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Rating") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("RatingComment") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("RatingTime") - .HasColumnType("TEXT"); + .HasColumnType("datetime(6)"); b.HasKey("Id"); @@ -175,19 +178,19 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Comment") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("MealId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("VoteOptionId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("Id"); @@ -205,13 +208,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("DeliveryDate") - .HasColumnType("TEXT"); + .HasColumnType("datetime(6)"); b.Property("MealWeekStatus") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("Id"); @@ -222,13 +225,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("ConfigCode") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Value") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("Id"); @@ -239,13 +242,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Weight") - .HasColumnType("REAL"); + .HasColumnType("double"); b.HasKey("Id"); @@ -256,18 +259,18 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("Comment") .IsRequired() .HasMaxLength(1000) - .HasColumnType("TEXT"); + .HasColumnType("varchar(1000)"); b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("WeekId") - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.HasKey("Id"); @@ -281,19 +284,19 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property("Id") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("Name") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.Property("NormalizedName") .HasMaxLength(256) - .HasColumnType("TEXT"); + .HasColumnType("varchar(256)"); b.HasKey("Id"); @@ -301,109 +304,109 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasDatabaseName("RoleNameIndex"); - b.ToTable("AspNetRoles"); + b.ToTable("AspNetRoles", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("ClaimType") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("ClaimValue") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("RoleId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.HasKey("Id"); b.HasIndex("RoleId"); - b.ToTable("AspNetRoleClaims"); + b.ToTable("AspNetRoleClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("int"); b.Property("ClaimType") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("ClaimValue") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("UserId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.HasKey("Id"); b.HasIndex("UserId"); - b.ToTable("AspNetUserClaims"); + b.ToTable("AspNetUserClaims", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("ProviderKey") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.Property("UserId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.HasKey("LoginProvider", "ProviderKey"); b.HasIndex("UserId"); - b.ToTable("AspNetUserLogins"); + b.ToTable("AspNetUserLogins", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("RoleId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.HasKey("UserId", "RoleId"); b.HasIndex("RoleId"); - b.ToTable("AspNetUserRoles"); + b.ToTable("AspNetUserRoles", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("LoginProvider") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("varchar(255)"); b.Property("Value") - .HasColumnType("TEXT"); + .HasColumnType("longtext"); b.HasKey("UserId", "LoginProvider", "Name"); - b.ToTable("AspNetUserTokens"); + b.ToTable("AspNetUserTokens", (string)null); }); modelBuilder.Entity("FoodPicker.Infrastructure.Models.AutoVote", b => diff --git a/FoodPicker.Web/Controllers/WeekController.cs b/FoodPicker.Web/Controllers/WeekController.cs index 96305db..eff3c92 100644 --- a/FoodPicker.Web/Controllers/WeekController.cs +++ b/FoodPicker.Web/Controllers/WeekController.cs @@ -211,7 +211,9 @@ public async Task Vote(int? id, [FromForm] MealVoteViewModel mode { if (dbVote.Id == 0) { - await _mealVoteRepo.AddAsync(dbVote); + // If there's no real data in the vote, no point in storing it. + if (dbVote.VoteOptionId != null || !string.IsNullOrEmpty(dbVote.Comment)) + await _mealVoteRepo.AddAsync(dbVote); } else { diff --git a/FoodPicker.Web/Startup.cs b/FoodPicker.Web/Startup.cs index 272033b..0947fa7 100644 --- a/FoodPicker.Web/Startup.cs +++ b/FoodPicker.Web/Startup.cs @@ -30,10 +30,17 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { + var connectionString = Configuration.GetConnectionString("DefaultConnection"); + if (string.IsNullOrEmpty(connectionString)) + { + throw new ApplicationException( + "A DefaultConnection configuration string for MySQL must be provided."); + } + services.AddDbContext(options => - options.UseSqlite( - Configuration.GetConnectionString("DefaultConnection"), + options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString), x => x.MigrationsAssembly("FoodPicker.Migrations"))); + services.AddDatabaseDeveloperPageExceptionFilter(); services.AddIdentity() diff --git a/FoodPicker.Web/appsettings.json b/FoodPicker.Web/appsettings.json index 686c5d7..bb982d7 100644 --- a/FoodPicker.Web/appsettings.json +++ b/FoodPicker.Web/appsettings.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "DefaultConnection": "DataSource=app.db;Cache=Shared" + "DefaultConnection": "" }, "Logging": { "LogLevel": {