contact-management-system / ContactManagementAPI /Migrations /20260208162549_MakeContactFieldsNullable.cs
| using System; | |
| using Microsoft.EntityFrameworkCore.Migrations; | |
| namespace ContactManagementAPI.Migrations | |
| { | |
| /// <inheritdoc /> | |
| public partial class MakeContactFieldsNullable : Migration | |
| { | |
| /// <inheritdoc /> | |
| protected override void Up(MigrationBuilder migrationBuilder) | |
| { | |
| migrationBuilder.AlterColumn<string>( | |
| name: "WhatsAppNumber", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "State", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "PostalCode", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "PhotoPath", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "OtherDetails", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "NickName", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "Mobile3", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "Mobile2", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "Mobile1", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "LastName", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "Email", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "Country", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "City", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "Address", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: true, | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)"); | |
| 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)); | |
| } | |
| /// <inheritdoc /> | |
| protected override void Down(MigrationBuilder migrationBuilder) | |
| { | |
| migrationBuilder.AlterColumn<string>( | |
| name: "WhatsAppNumber", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "State", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "PostalCode", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "PhotoPath", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "OtherDetails", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "NickName", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "Mobile3", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "Mobile2", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "Mobile1", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "LastName", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "Email", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "Country", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "City", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.AlterColumn<string>( | |
| name: "Address", | |
| table: "Contacts", | |
| type: "nvarchar(max)", | |
| nullable: false, | |
| defaultValue: "", | |
| oldClrType: typeof(string), | |
| oldType: "nvarchar(max)", | |
| oldNullable: true); | |
| migrationBuilder.UpdateData( | |
| table: "ContactGroups", | |
| keyColumn: "Id", | |
| keyValue: 1, | |
| column: "CreatedAt", | |
| value: new DateTime(2026, 2, 6, 22, 28, 46, 432, DateTimeKind.Local).AddTicks(2243)); | |
| migrationBuilder.UpdateData( | |
| table: "ContactGroups", | |
| keyColumn: "Id", | |
| keyValue: 2, | |
| column: "CreatedAt", | |
| value: new DateTime(2026, 2, 6, 22, 28, 46, 432, DateTimeKind.Local).AddTicks(2260)); | |
| migrationBuilder.UpdateData( | |
| table: "ContactGroups", | |
| keyColumn: "Id", | |
| keyValue: 3, | |
| column: "CreatedAt", | |
| value: new DateTime(2026, 2, 6, 22, 28, 46, 432, DateTimeKind.Local).AddTicks(2263)); | |
| migrationBuilder.UpdateData( | |
| table: "ContactGroups", | |
| keyColumn: "Id", | |
| keyValue: 4, | |
| column: "CreatedAt", | |
| value: new DateTime(2026, 2, 6, 22, 28, 46, 432, DateTimeKind.Local).AddTicks(2266)); | |
| migrationBuilder.UpdateData( | |
| table: "ContactGroups", | |
| keyColumn: "Id", | |
| keyValue: 5, | |
| column: "CreatedAt", | |
| value: new DateTime(2026, 2, 6, 22, 28, 46, 432, DateTimeKind.Local).AddTicks(2270)); | |
| migrationBuilder.UpdateData( | |
| table: "ContactGroups", | |
| keyColumn: "Id", | |
| keyValue: 6, | |
| column: "CreatedAt", | |
| value: new DateTime(2026, 2, 6, 22, 28, 46, 432, DateTimeKind.Local).AddTicks(2273)); | |
| } | |
| } | |
| } | |