20210418014800_FuelItemUseDouble.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using Microsoft.EntityFrameworkCore.Migrations;
  2. namespace Gateway.POS.Migrations
  3. {
  4. public partial class FuelItemUseDouble : Migration
  5. {
  6. protected override void Up(MigrationBuilder migrationBuilder)
  7. {
  8. migrationBuilder.DropForeignKey(
  9. name: "FK_FuelItems_Transactions_TransactionId",
  10. table: "FuelItems");
  11. migrationBuilder.DropForeignKey(
  12. name: "FK_Payment_Transactions_TransactionId",
  13. table: "Payment");
  14. migrationBuilder.AlterColumn<int>(
  15. name: "TransactionId",
  16. table: "Payment",
  17. type: "INTEGER",
  18. nullable: false,
  19. defaultValue: 0,
  20. oldClrType: typeof(int),
  21. oldType: "INTEGER",
  22. oldNullable: true);
  23. migrationBuilder.AlterColumn<int>(
  24. name: "TransactionId",
  25. table: "FuelItems",
  26. type: "INTEGER",
  27. nullable: false,
  28. defaultValue: 0,
  29. oldClrType: typeof(int),
  30. oldType: "INTEGER",
  31. oldNullable: true);
  32. migrationBuilder.AlterColumn<double>(
  33. name: "TotalVolume",
  34. table: "FuelItems",
  35. type: "REAL",
  36. nullable: true,
  37. oldClrType: typeof(decimal),
  38. oldType: "TEXT",
  39. oldNullable: true);
  40. migrationBuilder.AlterColumn<double>(
  41. name: "Qualtity",
  42. table: "FuelItems",
  43. type: "REAL",
  44. nullable: false,
  45. oldClrType: typeof(decimal),
  46. oldType: "TEXT");
  47. migrationBuilder.AlterColumn<double>(
  48. name: "Price",
  49. table: "FuelItems",
  50. type: "REAL",
  51. nullable: false,
  52. oldClrType: typeof(decimal),
  53. oldType: "TEXT");
  54. migrationBuilder.AlterColumn<double>(
  55. name: "Amount",
  56. table: "FuelItems",
  57. type: "REAL",
  58. nullable: false,
  59. oldClrType: typeof(decimal),
  60. oldType: "TEXT");
  61. migrationBuilder.AddForeignKey(
  62. name: "FK_FuelItems_Transactions_TransactionId",
  63. table: "FuelItems",
  64. column: "TransactionId",
  65. principalTable: "Transactions",
  66. principalColumn: "Id",
  67. onDelete: ReferentialAction.Cascade);
  68. migrationBuilder.AddForeignKey(
  69. name: "FK_Payment_Transactions_TransactionId",
  70. table: "Payment",
  71. column: "TransactionId",
  72. principalTable: "Transactions",
  73. principalColumn: "Id",
  74. onDelete: ReferentialAction.Cascade);
  75. }
  76. protected override void Down(MigrationBuilder migrationBuilder)
  77. {
  78. migrationBuilder.DropForeignKey(
  79. name: "FK_FuelItems_Transactions_TransactionId",
  80. table: "FuelItems");
  81. migrationBuilder.DropForeignKey(
  82. name: "FK_Payment_Transactions_TransactionId",
  83. table: "Payment");
  84. migrationBuilder.AlterColumn<int>(
  85. name: "TransactionId",
  86. table: "Payment",
  87. type: "INTEGER",
  88. nullable: true,
  89. oldClrType: typeof(int),
  90. oldType: "INTEGER");
  91. migrationBuilder.AlterColumn<int>(
  92. name: "TransactionId",
  93. table: "FuelItems",
  94. type: "INTEGER",
  95. nullable: true,
  96. oldClrType: typeof(int),
  97. oldType: "INTEGER");
  98. migrationBuilder.AlterColumn<decimal>(
  99. name: "TotalVolume",
  100. table: "FuelItems",
  101. type: "TEXT",
  102. nullable: true,
  103. oldClrType: typeof(double),
  104. oldType: "REAL",
  105. oldNullable: true);
  106. migrationBuilder.AlterColumn<decimal>(
  107. name: "Qualtity",
  108. table: "FuelItems",
  109. type: "TEXT",
  110. nullable: false,
  111. oldClrType: typeof(double),
  112. oldType: "REAL");
  113. migrationBuilder.AlterColumn<decimal>(
  114. name: "Price",
  115. table: "FuelItems",
  116. type: "TEXT",
  117. nullable: false,
  118. oldClrType: typeof(double),
  119. oldType: "REAL");
  120. migrationBuilder.AlterColumn<decimal>(
  121. name: "Amount",
  122. table: "FuelItems",
  123. type: "TEXT",
  124. nullable: false,
  125. oldClrType: typeof(double),
  126. oldType: "REAL");
  127. migrationBuilder.AddForeignKey(
  128. name: "FK_FuelItems_Transactions_TransactionId",
  129. table: "FuelItems",
  130. column: "TransactionId",
  131. principalTable: "Transactions",
  132. principalColumn: "Id",
  133. onDelete: ReferentialAction.Restrict);
  134. migrationBuilder.AddForeignKey(
  135. name: "FK_Payment_Transactions_TransactionId",
  136. table: "Payment",
  137. column: "TransactionId",
  138. principalTable: "Transactions",
  139. principalColumn: "Id",
  140. onDelete: ReferentialAction.Restrict);
  141. }
  142. }
  143. }