//
using System;
using MealPlanner.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace backend.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260414190645_InitialCreate")]
partial class InitialCreate
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.26")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("MealPlanner.Models.CheckedShoppingItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("IsChecked")
.HasColumnType("boolean");
b.Property("ItemName")
.IsRequired()
.HasColumnType("text");
b.Property("MealPlanId")
.HasColumnType("uuid");
b.Property("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("MealPlanId", "UserId", "ItemName");
b.ToTable("CheckedShoppingItems");
});
modelBuilder.Entity("MealPlanner.Models.MealPlan", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UserId")
.IsRequired()
.HasColumnType("text");
b.Property("WeekStart")
.HasColumnType("date");
b.HasKey("Id");
b.HasIndex("UserId", "WeekStart")
.IsUnique();
b.ToTable("MealPlans");
});
modelBuilder.Entity("MealPlanner.Models.MealPlanEntry", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Date")
.HasColumnType("date");
b.Property("MealPlanId")
.HasColumnType("uuid");
b.Property("RecipeId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("MealPlanId");
b.HasIndex("RecipeId");
b.ToTable("MealPlanEntries");
});
modelBuilder.Entity("MealPlanner.Models.Recipe", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("ExternalId")
.HasColumnType("text");
b.Property("ImageUrl")
.HasColumnType("text");
b.Property("Instructions")
.IsRequired()
.HasColumnType("text");
b.Property("Source")
.HasColumnType("integer");
b.Property("Title")
.IsRequired()
.HasColumnType("text");
b.Property("UserId")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ExternalId");
b.HasIndex("UserId");
b.ToTable("Recipes");
});
modelBuilder.Entity("MealPlanner.Models.RecipeIngredient", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Amount")
.HasColumnType("numeric");
b.Property("Category")
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("RecipeId")
.HasColumnType("uuid");
b.Property("Unit")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RecipeId");
b.ToTable("RecipeIngredients");
});
modelBuilder.Entity("MealPlanner.Models.UserSettings", b =>
{
b.Property("UserId")
.HasColumnType("text");
b.Property("HouseholdSize")
.HasColumnType("integer");
b.HasKey("UserId");
b.ToTable("UserSettings");
});
modelBuilder.Entity("MealPlanner.Models.MealPlanEntry", b =>
{
b.HasOne("MealPlanner.Models.MealPlan", "MealPlan")
.WithMany("Entries")
.HasForeignKey("MealPlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("MealPlanner.Models.Recipe", "Recipe")
.WithMany()
.HasForeignKey("RecipeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("MealPlan");
b.Navigation("Recipe");
});
modelBuilder.Entity("MealPlanner.Models.RecipeIngredient", b =>
{
b.HasOne("MealPlanner.Models.Recipe", "Recipe")
.WithMany("Ingredients")
.HasForeignKey("RecipeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Recipe");
});
modelBuilder.Entity("MealPlanner.Models.MealPlan", b =>
{
b.Navigation("Entries");
});
modelBuilder.Entity("MealPlanner.Models.Recipe", b =>
{
b.Navigation("Ingredients");
});
#pragma warning restore 612, 618
}
}
}