20210418020104_addPayments.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. namespace Gateway.POS.Migrations
  3. {
  4. public partial class addPayments : Migration
  5. {
  6. protected override void Up(MigrationBuilder migrationBuilder)
  7. {
  8. migrationBuilder.DropForeignKey(
  9. name: "FK_Payment_Transactions_TransactionId",
  10. table: "Payment");
  11. migrationBuilder.DropPrimaryKey(
  12. name: "PK_Payment",
  13. table: "Payment");
  14. migrationBuilder.RenameTable(
  15. name: "Payment",
  16. newName: "Payments");
  17. migrationBuilder.RenameIndex(
  18. name: "IX_Payment_TransactionId",
  19. table: "Payments",
  20. newName: "IX_Payments_TransactionId");
  21. migrationBuilder.AlterColumn<double>(
  22. name: "TotalAmount",
  23. table: "Transactions",
  24. type: "REAL",
  25. nullable: true,
  26. oldClrType: typeof(decimal),
  27. oldType: "TEXT",
  28. oldNullable: true);
  29. migrationBuilder.AlterColumn<double>(
  30. name: "NetAmount",
  31. table: "Transactions",
  32. type: "REAL",
  33. nullable: true,
  34. oldClrType: typeof(decimal),
  35. oldType: "TEXT",
  36. oldNullable: true);
  37. migrationBuilder.AlterColumn<double>(
  38. name: "PaidAmount",
  39. table: "Payments",
  40. type: "REAL",
  41. nullable: false,
  42. oldClrType: typeof(decimal),
  43. oldType: "TEXT");
  44. migrationBuilder.AlterColumn<double>(
  45. name: "ExpectAmount",
  46. table: "Payments",
  47. type: "REAL",
  48. nullable: false,
  49. oldClrType: typeof(decimal),
  50. oldType: "TEXT");
  51. migrationBuilder.AddPrimaryKey(
  52. name: "PK_Payments",
  53. table: "Payments",
  54. column: "Id");
  55. migrationBuilder.AddForeignKey(
  56. name: "FK_Payments_Transactions_TransactionId",
  57. table: "Payments",
  58. column: "TransactionId",
  59. principalTable: "Transactions",
  60. principalColumn: "Id",
  61. onDelete: ReferentialAction.Cascade);
  62. }
  63. protected override void Down(MigrationBuilder migrationBuilder)
  64. {
  65. migrationBuilder.DropForeignKey(
  66. name: "FK_Payments_Transactions_TransactionId",
  67. table: "Payments");
  68. migrationBuilder.DropPrimaryKey(
  69. name: "PK_Payments",
  70. table: "Payments");
  71. migrationBuilder.RenameTable(
  72. name: "Payments",
  73. newName: "Payment");
  74. migrationBuilder.RenameIndex(
  75. name: "IX_Payments_TransactionId",
  76. table: "Payment",
  77. newName: "IX_Payment_TransactionId");
  78. migrationBuilder.AlterColumn<decimal>(
  79. name: "TotalAmount",
  80. table: "Transactions",
  81. type: "TEXT",
  82. nullable: true,
  83. oldClrType: typeof(double),
  84. oldType: "REAL",
  85. oldNullable: true);
  86. migrationBuilder.AlterColumn<decimal>(
  87. name: "NetAmount",
  88. table: "Transactions",
  89. type: "TEXT",
  90. nullable: true,
  91. oldClrType: typeof(double),
  92. oldType: "REAL",
  93. oldNullable: true);
  94. migrationBuilder.AlterColumn<decimal>(
  95. name: "PaidAmount",
  96. table: "Payment",
  97. type: "TEXT",
  98. nullable: false,
  99. oldClrType: typeof(double),
  100. oldType: "REAL");
  101. migrationBuilder.AlterColumn<decimal>(
  102. name: "ExpectAmount",
  103. table: "Payment",
  104. type: "TEXT",
  105. nullable: false,
  106. oldClrType: typeof(double),
  107. oldType: "REAL");
  108. migrationBuilder.AddPrimaryKey(
  109. name: "PK_Payment",
  110. table: "Payment",
  111. column: "Id");
  112. migrationBuilder.AddForeignKey(
  113. name: "FK_Payment_Transactions_TransactionId",
  114. table: "Payment",
  115. column: "TransactionId",
  116. principalTable: "Transactions",
  117. principalColumn: "Id",
  118. onDelete: ReferentialAction.Cascade);
  119. }
  120. }
  121. }