20211129050420_EditArea.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace Ropin.Inspection.Model.Migrations
  4. {
  5. public partial class EditArea : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.AlterColumn<Guid>(
  10. name: "C_StoreCode",
  11. table: "TPNT_Area",
  12. type: "char(36)",
  13. nullable: false,
  14. oldClrType: typeof(string),
  15. oldType: "varchar(50) CHARACTER SET utf8mb4",
  16. oldMaxLength: 50);
  17. migrationBuilder.AlterColumn<string>(
  18. name: "C_Remark",
  19. table: "TPNT_Area",
  20. type: "varchar(1024) CHARACTER SET utf8mb4",
  21. maxLength: 1024,
  22. nullable: true,
  23. oldClrType: typeof(string),
  24. oldType: "varchar(500) CHARACTER SET utf8mb4",
  25. oldMaxLength: 500,
  26. oldNullable: true);
  27. migrationBuilder.CreateIndex(
  28. name: "IX_TPNT_Area_C_StoreCode",
  29. table: "TPNT_Area",
  30. column: "C_StoreCode");
  31. migrationBuilder.AddForeignKey(
  32. name: "FK_TPNT_Area_TPNT_Store_C_StoreCode",
  33. table: "TPNT_Area",
  34. column: "C_StoreCode",
  35. principalTable: "TPNT_Store",
  36. principalColumn: "C_ID",
  37. onDelete: ReferentialAction.Restrict);
  38. }
  39. protected override void Down(MigrationBuilder migrationBuilder)
  40. {
  41. migrationBuilder.DropForeignKey(
  42. name: "FK_TPNT_Area_TPNT_Store_C_StoreCode",
  43. table: "TPNT_Area");
  44. migrationBuilder.DropIndex(
  45. name: "IX_TPNT_Area_C_StoreCode",
  46. table: "TPNT_Area");
  47. migrationBuilder.AlterColumn<string>(
  48. name: "C_StoreCode",
  49. table: "TPNT_Area",
  50. type: "varchar(50) CHARACTER SET utf8mb4",
  51. maxLength: 50,
  52. nullable: false,
  53. oldClrType: typeof(Guid),
  54. oldType: "char(36)");
  55. migrationBuilder.AlterColumn<string>(
  56. name: "C_Remark",
  57. table: "TPNT_Area",
  58. type: "varchar(500) CHARACTER SET utf8mb4",
  59. maxLength: 500,
  60. nullable: true,
  61. oldClrType: typeof(string),
  62. oldType: "varchar(1024) CHARACTER SET utf8mb4",
  63. oldMaxLength: 1024,
  64. oldNullable: true);
  65. }
  66. }
  67. }