20240520183928_altrcity.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace MTWorkHR.Infrastructure.Migrations
  5. {
  6. /// <inheritdoc />
  7. public partial class altrcity : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.AddColumn<string>(
  13. name: "NameFr",
  14. table: "CountryLookups",
  15. type: "nvarchar(max)",
  16. nullable: false,
  17. defaultValue: "");
  18. migrationBuilder.CreateTable(
  19. name: "Cities",
  20. columns: table => new
  21. {
  22. Id = table.Column<long>(type: "bigint", nullable: false)
  23. .Annotation("SqlServer:Identity", "1, 1"),
  24. NameAr = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  25. NameEn = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
  26. NameFr = table.Column<string>(type: "nvarchar(max)", nullable: false),
  27. CountryId = table.Column<long>(type: "bigint", nullable: false),
  28. Code = table.Column<string>(type: "nvarchar(max)", nullable: false)
  29. },
  30. constraints: table =>
  31. {
  32. table.PrimaryKey("PK_Cities", x => x.Id);
  33. table.ForeignKey(
  34. name: "FK_Cities_CountryLookups_CountryId",
  35. column: x => x.CountryId,
  36. principalTable: "CountryLookups",
  37. principalColumn: "Id",
  38. onDelete: ReferentialAction.Cascade);
  39. });
  40. migrationBuilder.CreateTable(
  41. name: "LoginOTPs",
  42. columns: table => new
  43. {
  44. Id = table.Column<long>(type: "bigint", nullable: false)
  45. .Annotation("SqlServer:Identity", "1, 1"),
  46. OTP = table.Column<string>(type: "nvarchar(max)", nullable: false),
  47. UserId = table.Column<string>(type: "nvarchar(max)", nullable: false),
  48. CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
  49. ExpireDate = table.Column<DateTime>(type: "datetime2", nullable: false)
  50. },
  51. constraints: table =>
  52. {
  53. table.PrimaryKey("PK_LoginOTPs", x => x.Id);
  54. });
  55. migrationBuilder.CreateIndex(
  56. name: "IX_Cities_CountryId",
  57. table: "Cities",
  58. column: "CountryId");
  59. }
  60. /// <inheritdoc />
  61. protected override void Down(MigrationBuilder migrationBuilder)
  62. {
  63. migrationBuilder.DropTable(
  64. name: "Cities");
  65. migrationBuilder.DropTable(
  66. name: "LoginOTPs");
  67. migrationBuilder.DropColumn(
  68. name: "NameFr",
  69. table: "CountryLookups");
  70. }
  71. }
  72. }