// using System; using ExpenseTracker.Api.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 ExpenseTracker.Api.Migrations { [DbContext(typeof(AppDbContext))] [Migration("20260902125250_InitialCreate")] partial class InitialCreate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.11") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ExpenseTracker.Api.Models.AppSetting", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid") .HasColumnName("id"); b.Property("Key") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)") .HasColumnName("key"); b.Property("Value") .IsRequired() .HasColumnType("text") .HasColumnName("value"); b.HasKey("Id"); b.HasIndex("Key") .IsUnique() .HasDatabaseName("ix_app_settings_key_unique"); b.ToTable("app_settings", (string)null); b.HasData( new { Id = new Guid("20000000-0000-0000-0000-000000000001"), Key = "default_salary", Value = "0" }); }); modelBuilder.Entity("ExpenseTracker.Api.Models.Category", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid") .HasColumnName("id"); b.Property("Color") .IsRequired() .HasMaxLength(7) .HasColumnType("character varying(7)") .HasColumnName("color"); b.Property("Name") .IsRequired() .HasMaxLength(100) .HasColumnType("character varying(100)") .HasColumnName("name"); b.HasKey("Id"); b.ToTable("categories", (string)null); b.HasData( new { Id = new Guid("10000000-0000-0000-0000-000000000001"), Color = "#ef4444", Name = "Alimentation" }, new { Id = new Guid("10000000-0000-0000-0000-000000000002"), Color = "#f97316", Name = "Transport" }, new { Id = new Guid("10000000-0000-0000-0000-000000000003"), Color = "#eab308", Name = "Logement" }, new { Id = new Guid("10000000-0000-0000-0000-000000000004"), Color = "#22c55e", Name = "Santé" }, new { Id = new Guid("10000000-0000-0000-0000-000000000005"), Color = "#3b82f6", Name = "Loisirs" }, new { Id = new Guid("10000000-0000-0000-0000-000000000006"), Color = "#a855f7", Name = "Abonnements" }, new { Id = new Guid("10000000-0000-0000-0000-000000000007"), Color = "#6b7280", Name = "Autre" }); }); modelBuilder.Entity("ExpenseTracker.Api.Models.Entry", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid") .HasColumnName("id"); b.Property("Amount") .HasColumnType("DECIMAL(12,2)") .HasColumnName("amount"); b.Property("CategoryId") .HasColumnType("uuid") .HasColumnName("category_id"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("created_at"); b.Property("EntryDate") .HasColumnType("date") .HasColumnName("entry_date"); b.Property("Label") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)") .HasColumnName("label"); b.Property("MonthId") .HasColumnType("uuid") .HasColumnName("month_id"); b.Property("Type") .IsRequired() .HasColumnType("text") .HasColumnName("type"); b.HasKey("Id"); b.HasIndex("CategoryId") .HasDatabaseName("ix_entries_category_id"); b.HasIndex("MonthId") .HasDatabaseName("ix_entries_month_id"); b.ToTable("entries", (string)null); }); modelBuilder.Entity("ExpenseTracker.Api.Models.Month", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid") .HasColumnName("id"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("created_at"); b.Property("DefaultSalary") .HasColumnType("DECIMAL(12,2)") .HasColumnName("default_salary"); b.Property("MonthNumber") .HasColumnType("integer") .HasColumnName("month"); b.Property("Year") .HasColumnType("integer") .HasColumnName("year"); b.HasKey("Id"); b.HasIndex("Year", "MonthNumber") .IsUnique() .HasDatabaseName("ix_months_year_month_unique"); b.ToTable("months", (string)null); }); modelBuilder.Entity("ExpenseTracker.Api.Models.Entry", b => { b.HasOne("ExpenseTracker.Api.Models.Category", "Category") .WithMany("Entries") .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.SetNull); b.HasOne("ExpenseTracker.Api.Models.Month", "Month") .WithMany("Entries") .HasForeignKey("MonthId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Category"); b.Navigation("Month"); }); modelBuilder.Entity("ExpenseTracker.Api.Models.Category", b => { b.Navigation("Entries"); }); modelBuilder.Entity("ExpenseTracker.Api.Models.Month", b => { b.Navigation("Entries"); }); #pragma warning restore 612, 618 } } }