contact-management-system / ContactManagementAPI /Migrations /20260209052719_AddSampleData.cs
deploy
Deploy restore contacts feature
fc06b79
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ContactManagementAPI.Migrations
{
/// <inheritdoc />
public partial class AddSampleData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "ContactGroups",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 2, 9, 10, 57, 18, 734, DateTimeKind.Local).AddTicks(8518));
migrationBuilder.UpdateData(
table: "ContactGroups",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 2, 9, 10, 57, 18, 734, DateTimeKind.Local).AddTicks(8531));
migrationBuilder.UpdateData(
table: "ContactGroups",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 2, 9, 10, 57, 18, 734, DateTimeKind.Local).AddTicks(8533));
migrationBuilder.UpdateData(
table: "ContactGroups",
keyColumn: "Id",
keyValue: 4,
column: "CreatedAt",
value: new DateTime(2026, 2, 9, 10, 57, 18, 734, DateTimeKind.Local).AddTicks(8535));
migrationBuilder.UpdateData(
table: "ContactGroups",
keyColumn: "Id",
keyValue: 5,
column: "CreatedAt",
value: new DateTime(2026, 2, 9, 10, 57, 18, 734, DateTimeKind.Local).AddTicks(8537));
migrationBuilder.UpdateData(
table: "ContactGroups",
keyColumn: "Id",
keyValue: 6,
column: "CreatedAt",
value: new DateTime(2026, 2, 9, 10, 57, 18, 734, DateTimeKind.Local).AddTicks(8538));
// Insert sample contacts
migrationBuilder.InsertData(
table: "Contacts",
columns: new[] { "Id", "FirstName", "LastName", "NickName", "Email", "Mobile1", "Mobile2", "Mobile3", "WhatsAppNumber", "Address", "City", "State", "PostalCode", "Country", "PhotoPath", "GroupId", "OtherDetails", "CreatedAt", "UpdatedAt" },
values: new object[,]
{
{ 1, "John", "Doe", "Johnny", "john.doe@email.com", "+1-555-0101", "+1-555-0102", null, "+1-555-0101", "123 Main Street", "New York", "NY", "10001", "USA", "/uploads/photos/1_sample.jpg", 1, "Close friend from college", new DateTime(2026, 2, 9, 10, 30, 0), new DateTime(2026, 2, 9, 10, 30, 0) },
{ 2, "Sarah", "Smith", "Sara", "sarah.smith@email.com", "+1-555-0201", "+1-555-0202", "+1-555-0203", "+1-555-0201", "456 Oak Avenue", "Los Angeles", "CA", "90001", "USA", "/uploads/photos/2_sample.jpg", 2, "Works at Tech Corp", new DateTime(2026, 2, 9, 10, 32, 0), new DateTime(2026, 2, 9, 10, 32, 0) },
{ 3, "Michael", "Johnson", "Mike", "michael.j@email.com", "+1-555-0301", null, null, "+1-555-0301", "789 Pine Road", "Chicago", "IL", "60601", "USA", "/uploads/photos/3_sample.jpg", 3, "Project manager", new DateTime(2026, 2, 9, 10, 34, 0), new DateTime(2026, 2, 9, 10, 34, 0) },
{ 4, "Emily", "Brown", "Em", "emily.brown@email.com", "+1-555-0401", "+1-555-0402", null, "+1-555-0401", "321 Elm Street", "Houston", "TX", "77001", "USA", "/uploads/photos/4_sample.jpg", 1, "Sister, lives in Houston", new DateTime(2026, 2, 9, 10, 36, 0), new DateTime(2026, 2, 9, 10, 36, 0) },
{ 5, "David", "Wilson", "Dave", "david.w@email.com", "+1-555-0501", "+1-555-0502", "+1-555-0503", "+1-555-0501", "654 Cedar Lane", "Phoenix", "AZ", "85001", "USA", "/uploads/photos/5_sample.jpg", 4, "School principal", new DateTime(2026, 2, 9, 10, 38, 0), new DateTime(2026, 2, 9, 10, 38, 0) }
});
// Insert sample documents
migrationBuilder.InsertData(
table: "ContactDocuments",
columns: new[] { "ContactId", "DocumentPath", "FileName", "FileSize", "ContentType", "DocumentType", "UploadedAt" },
values: new object[,]
{
{ 1, "/uploads/documents/1_ID_Proof.pdf", "john_doe_id.pdf", 145000L, "application/pdf", "ID", new DateTime(2026, 2, 9, 10, 30, 0) },
{ 1, "/uploads/documents/1_Resume.pdf", "john_doe_resume.pdf", 235000L, "application/pdf", "Resume", new DateTime(2026, 2, 9, 10, 31, 0) },
{ 2, "/uploads/documents/2_Business_Card.pdf", "sarah_smith_business.pdf", 89000L, "application/pdf", "Business", new DateTime(2026, 2, 9, 10, 32, 0) },
{ 2, "/uploads/documents/2_Address_Proof.pdf", "sarah_address.pdf", 156000L, "application/pdf", "Address", new DateTime(2026, 2, 9, 10, 33, 0) },
{ 3, "/uploads/documents/3_Contract.pdf", "michael_contract.pdf", 289000L, "application/pdf", "Contract", new DateTime(2026, 2, 9, 10, 34, 0) },
{ 4, "/uploads/documents/4_ID_Proof.pdf", "emily_id.pdf", 167000L, "application/pdf", "ID", new DateTime(2026, 2, 9, 10, 36, 0) },
{ 5, "/uploads/documents/5_Certification.pdf", "david_certification.pdf", 198000L, "application/pdf", "Certification", new DateTime(2026, 2, 9, 10, 38, 0) },
{ 5, "/uploads/documents/5_License.pdf", "david_license.pdf", 142000L, "application/pdf", "License", new DateTime(2026, 2, 9, 10, 39, 0) }
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "ContactDocuments",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "ContactDocuments",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "ContactDocuments",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "ContactDocuments",
keyColumn: "Id",
keyValue: 4);
migrationBuilder.DeleteData(
table: "ContactDocuments",
keyColumn: "Id",
keyValue: 5);
migrationBuilder.DeleteData(
table: "ContactDocuments",
keyColumn: "Id",
keyValue: 6);
migrationBuilder.DeleteData(
table: "ContactDocuments",
keyColumn: "Id",
keyValue: 7);
migrationBuilder.DeleteData(
table: "ContactDocuments",
keyColumn: "Id",
keyValue: 8);
migrationBuilder.DeleteData(
table: "Contacts",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Contacts",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Contacts",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Contacts",
keyColumn: "Id",
keyValue: 4);
migrationBuilder.DeleteData(
table: "Contacts",
keyColumn: "Id",
keyValue: 5);
migrationBuilder.UpdateData(
table: "ContactGroups",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 2, 8, 21, 55, 46, 992, DateTimeKind.Local).AddTicks(5320));
migrationBuilder.UpdateData(
table: "ContactGroups",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 2, 8, 21, 55, 46, 992, DateTimeKind.Local).AddTicks(5332));
migrationBuilder.UpdateData(
table: "ContactGroups",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 2, 8, 21, 55, 46, 992, DateTimeKind.Local).AddTicks(5333));
migrationBuilder.UpdateData(
table: "ContactGroups",
keyColumn: "Id",
keyValue: 4,
column: "CreatedAt",
value: new DateTime(2026, 2, 8, 21, 55, 46, 992, DateTimeKind.Local).AddTicks(5335));
migrationBuilder.UpdateData(
table: "ContactGroups",
keyColumn: "Id",
keyValue: 5,
column: "CreatedAt",
value: new DateTime(2026, 2, 8, 21, 55, 46, 992, DateTimeKind.Local).AddTicks(5339));
migrationBuilder.UpdateData(
table: "ContactGroups",
keyColumn: "Id",
keyValue: 6,
column: "CreatedAt",
value: new DateTime(2026, 2, 8, 21, 55, 46, 992, DateTimeKind.Local).AddTicks(5340));
}
}
}