//
using System;
using ContactManagementAPI.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace ContactManagementAPI.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260209052719_AddSampleData")]
partial class AddSampleData
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("ContactManagementAPI.Models.Contact", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Address")
.HasColumnType("nvarchar(max)");
b.Property("City")
.HasColumnType("nvarchar(max)");
b.Property("Country")
.HasColumnType("nvarchar(max)");
b.Property("CreatedAt")
.HasColumnType("datetime2");
b.Property("Email")
.HasColumnType("nvarchar(max)");
b.Property("FirstName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("GroupId")
.HasColumnType("int");
b.Property("LastName")
.HasColumnType("nvarchar(max)");
b.Property("Mobile1")
.HasColumnType("nvarchar(max)");
b.Property("Mobile2")
.HasColumnType("nvarchar(max)");
b.Property("Mobile3")
.HasColumnType("nvarchar(max)");
b.Property("NickName")
.HasColumnType("nvarchar(max)");
b.Property("OtherDetails")
.HasColumnType("nvarchar(max)");
b.Property("PhotoPath")
.HasColumnType("nvarchar(max)");
b.Property("PostalCode")
.HasColumnType("nvarchar(max)");
b.Property("State")
.HasColumnType("nvarchar(max)");
b.Property("UpdatedAt")
.HasColumnType("datetime2");
b.Property("WhatsAppNumber")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("GroupId");
b.ToTable("Contacts");
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactDocument", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("ContactId")
.HasColumnType("int");
b.Property("ContentType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("DocumentPath")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("DocumentType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("FileName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("FileSize")
.HasColumnType("bigint");
b.Property("UploadedAt")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("ContactId");
b.ToTable("ContactDocuments");
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactGroup", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("datetime2");
b.Property("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("ContactGroups");
b.HasData(
new
{
Id = 1,
CreatedAt = new DateTime(2026, 2, 9, 10, 57, 18, 734, DateTimeKind.Local).AddTicks(8518),
Description = "Family members",
Name = "Family"
},
new
{
Id = 2,
CreatedAt = new DateTime(2026, 2, 9, 10, 57, 18, 734, DateTimeKind.Local).AddTicks(8531),
Description = "Friends",
Name = "Friends"
},
new
{
Id = 3,
CreatedAt = new DateTime(2026, 2, 9, 10, 57, 18, 734, DateTimeKind.Local).AddTicks(8533),
Description = "Business contacts",
Name = "Business"
},
new
{
Id = 4,
CreatedAt = new DateTime(2026, 2, 9, 10, 57, 18, 734, DateTimeKind.Local).AddTicks(8535),
Description = "School contacts",
Name = "School"
},
new
{
Id = 5,
CreatedAt = new DateTime(2026, 2, 9, 10, 57, 18, 734, DateTimeKind.Local).AddTicks(8537),
Description = "Church members",
Name = "Church"
},
new
{
Id = 6,
CreatedAt = new DateTime(2026, 2, 9, 10, 57, 18, 734, DateTimeKind.Local).AddTicks(8538),
Description = "Other contacts",
Name = "Others"
});
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactPhoto", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("ContactId")
.HasColumnType("int");
b.Property("ContentType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("FileName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("FileSize")
.HasColumnType("bigint");
b.Property("IsProfilePhoto")
.HasColumnType("bit");
b.Property("PhotoPath")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("UploadedAt")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("ContactId");
b.ToTable("ContactPhotos");
});
modelBuilder.Entity("ContactManagementAPI.Models.Contact", b =>
{
b.HasOne("ContactManagementAPI.Models.ContactGroup", "Group")
.WithMany("Contacts")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Group");
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactDocument", b =>
{
b.HasOne("ContactManagementAPI.Models.Contact", "Contact")
.WithMany("Documents")
.HasForeignKey("ContactId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Contact");
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactPhoto", b =>
{
b.HasOne("ContactManagementAPI.Models.Contact", "Contact")
.WithMany("Photos")
.HasForeignKey("ContactId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Contact");
});
modelBuilder.Entity("ContactManagementAPI.Models.Contact", b =>
{
b.Navigation("Documents");
b.Navigation("Photos");
});
modelBuilder.Entity("ContactManagementAPI.Models.ContactGroup", b =>
{
b.Navigation("Contacts");
});
#pragma warning restore 612, 618
}
}
}