20240604083451_altrAddress.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. #nullable disable
  3. namespace MTWorkHR.Infrastructure.Migrations
  4. {
  5. /// <inheritdoc />
  6. public partial class altrAddress : Migration
  7. {
  8. /// <inheritdoc />
  9. protected override void Up(MigrationBuilder migrationBuilder)
  10. {
  11. migrationBuilder.DropColumn(
  12. name: "City",
  13. table: "UserAddress");
  14. migrationBuilder.AlterColumn<long>(
  15. name: "CountryId",
  16. table: "UserAddress",
  17. type: "bigint",
  18. nullable: true,
  19. oldClrType: typeof(int),
  20. oldType: "int",
  21. oldNullable: true);
  22. migrationBuilder.AddColumn<long>(
  23. name: "CityId",
  24. table: "UserAddress",
  25. type: "bigint",
  26. nullable: true);
  27. migrationBuilder.CreateIndex(
  28. name: "IX_UserAddress_CityId",
  29. table: "UserAddress",
  30. column: "CityId");
  31. migrationBuilder.CreateIndex(
  32. name: "IX_UserAddress_CountryId",
  33. table: "UserAddress",
  34. column: "CountryId");
  35. migrationBuilder.AddForeignKey(
  36. name: "FK_UserAddress_Cities_CityId",
  37. table: "UserAddress",
  38. column: "CityId",
  39. principalTable: "Cities",
  40. principalColumn: "Id");
  41. migrationBuilder.AddForeignKey(
  42. name: "FK_UserAddress_CountryLookups_CountryId",
  43. table: "UserAddress",
  44. column: "CountryId",
  45. principalTable: "CountryLookups",
  46. principalColumn: "Id");
  47. }
  48. /// <inheritdoc />
  49. protected override void Down(MigrationBuilder migrationBuilder)
  50. {
  51. migrationBuilder.DropForeignKey(
  52. name: "FK_UserAddress_Cities_CityId",
  53. table: "UserAddress");
  54. migrationBuilder.DropForeignKey(
  55. name: "FK_UserAddress_CountryLookups_CountryId",
  56. table: "UserAddress");
  57. migrationBuilder.DropIndex(
  58. name: "IX_UserAddress_CityId",
  59. table: "UserAddress");
  60. migrationBuilder.DropIndex(
  61. name: "IX_UserAddress_CountryId",
  62. table: "UserAddress");
  63. migrationBuilder.DropColumn(
  64. name: "CityId",
  65. table: "UserAddress");
  66. migrationBuilder.AlterColumn<int>(
  67. name: "CountryId",
  68. table: "UserAddress",
  69. type: "int",
  70. nullable: true,
  71. oldClrType: typeof(long),
  72. oldType: "bigint",
  73. oldNullable: true);
  74. migrationBuilder.AddColumn<string>(
  75. name: "City",
  76. table: "UserAddress",
  77. type: "nvarchar(max)",
  78. nullable: true);
  79. }
  80. }
  81. }