| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- namespace Gateway.POS.Migrations
- {
- public partial class InitialCreate : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Discounts",
- columns: table => new
- {
- Id = table.Column<int>(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- IsMarkedAsDeletion = table.Column<bool>(type: "INTEGER", nullable: false),
- Name = table.Column<string>(type: "TEXT", nullable: true),
- Description = table.Column<string>(type: "TEXT", nullable: true),
- DiscountType = table.Column<int>(type: "INTEGER", nullable: false),
- StartTime = table.Column<DateTime>(type: "TEXT", nullable: true),
- EndTime = table.Column<DateTime>(type: "TEXT", nullable: true),
- CreatedTime = table.Column<DateTime>(type: "TEXT", nullable: false),
- ModifiedTime = table.Column<DateTime>(type: "TEXT", nullable: true),
- TargetFuelProductCode = table.Column<string>(type: "TEXT", nullable: true),
- Command = table.Column<string>(type: "TEXT", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Discounts", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "Transactions",
- columns: table => new
- {
- Id = table.Column<int>(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- TransactionType = table.Column<int>(type: "INTEGER", nullable: false),
- TotalAmount = table.Column<decimal>(type: "TEXT", nullable: true),
- NetAmount = table.Column<decimal>(type: "TEXT", nullable: true),
- ReceiptId = table.Column<string>(type: "TEXT", nullable: true),
- OperatorId = table.Column<string>(type: "TEXT", nullable: true),
- ShiftId = table.Column<string>(type: "TEXT", nullable: true),
- TerminalId = table.Column<string>(type: "TEXT", nullable: true),
- SiteId = table.Column<string>(type: "TEXT", nullable: true),
- ClientSideTimestamp = table.Column<DateTime>(type: "TEXT", nullable: true),
- ServerSideTimestamp = table.Column<DateTime>(type: "TEXT", nullable: false),
- Comment = table.Column<string>(type: "TEXT", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Transactions", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "AppliedDiscount",
- columns: table => new
- {
- Id = table.Column<int>(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- DiscountId = table.Column<int>(type: "INTEGER", nullable: false),
- DiscountedAmount = table.Column<decimal>(type: "TEXT", nullable: false),
- TransactionId = table.Column<int>(type: "INTEGER", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AppliedDiscount", x => x.Id);
- table.ForeignKey(
- name: "FK_AppliedDiscount_Discounts_DiscountId",
- column: x => x.DiscountId,
- principalTable: "Discounts",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_AppliedDiscount_Transactions_TransactionId",
- column: x => x.TransactionId,
- principalTable: "Transactions",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
- migrationBuilder.CreateTable(
- name: "FuelItems",
- columns: table => new
- {
- Id = table.Column<int>(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- PumpId = table.Column<int>(type: "INTEGER", nullable: false),
- NozzleLogicalId = table.Column<int>(type: "INTEGER", nullable: false),
- SiteLevelNozzleId = table.Column<int>(type: "INTEGER", nullable: true),
- FuelProductName = table.Column<string>(type: "TEXT", nullable: true),
- FuelProductCode = table.Column<string>(type: "TEXT", nullable: true),
- Qualtity = table.Column<decimal>(type: "TEXT", nullable: false),
- Price = table.Column<decimal>(type: "TEXT", nullable: false),
- Amount = table.Column<decimal>(type: "TEXT", nullable: false),
- TotalVolume = table.Column<decimal>(type: "TEXT", nullable: true),
- FuelTrxSequenceNumber = table.Column<string>(type: "TEXT", nullable: true),
- FuelingStartTime = table.Column<DateTime>(type: "TEXT", nullable: true),
- FuelingEndTime = table.Column<DateTime>(type: "TEXT", nullable: true),
- TransactionId = table.Column<int>(type: "INTEGER", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_FuelItems", x => x.Id);
- table.ForeignKey(
- name: "FK_FuelItems_Transactions_TransactionId",
- column: x => x.TransactionId,
- principalTable: "Transactions",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
- migrationBuilder.CreateTable(
- name: "Payment",
- columns: table => new
- {
- Id = table.Column<int>(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- Method = table.Column<int>(type: "INTEGER", nullable: false),
- AuthCode = table.Column<string>(type: "TEXT", nullable: true),
- BillNumber = table.Column<string>(type: "TEXT", nullable: true),
- ExpectAmount = table.Column<decimal>(type: "TEXT", nullable: false),
- PaidAmount = table.Column<decimal>(type: "TEXT", nullable: false),
- TradeStatus = table.Column<int>(type: "INTEGER", nullable: false),
- Comment = table.Column<string>(type: "TEXT", nullable: true),
- TransactionId = table.Column<int>(type: "INTEGER", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Payment", x => x.Id);
- table.ForeignKey(
- name: "FK_Payment_Transactions_TransactionId",
- column: x => x.TransactionId,
- principalTable: "Transactions",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
- migrationBuilder.CreateIndex(
- name: "IX_AppliedDiscount_DiscountId",
- table: "AppliedDiscount",
- column: "DiscountId");
- migrationBuilder.CreateIndex(
- name: "IX_AppliedDiscount_TransactionId",
- table: "AppliedDiscount",
- column: "TransactionId");
- migrationBuilder.CreateIndex(
- name: "IX_FuelItems_Amount",
- table: "FuelItems",
- column: "Amount");
- migrationBuilder.CreateIndex(
- name: "IX_FuelItems_FuelProductCode",
- table: "FuelItems",
- column: "FuelProductCode");
- migrationBuilder.CreateIndex(
- name: "IX_FuelItems_PumpId_NozzleLogicalId",
- table: "FuelItems",
- columns: new[] { "PumpId", "NozzleLogicalId" });
- migrationBuilder.CreateIndex(
- name: "IX_FuelItems_SiteLevelNozzleId",
- table: "FuelItems",
- column: "SiteLevelNozzleId");
- migrationBuilder.CreateIndex(
- name: "IX_FuelItems_TransactionId",
- table: "FuelItems",
- column: "TransactionId");
- migrationBuilder.CreateIndex(
- name: "IX_Payment_TransactionId",
- table: "Payment",
- column: "TransactionId");
- migrationBuilder.CreateIndex(
- name: "IX_Transactions_Id",
- table: "Transactions",
- column: "Id",
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_Transactions_NetAmount",
- table: "Transactions",
- column: "NetAmount");
- migrationBuilder.CreateIndex(
- name: "IX_Transactions_ReceiptId",
- table: "Transactions",
- column: "ReceiptId",
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_Transactions_ServerSideTimestamp",
- table: "Transactions",
- column: "ServerSideTimestamp");
- migrationBuilder.CreateIndex(
- name: "IX_Transactions_ShiftId",
- table: "Transactions",
- column: "ShiftId");
- migrationBuilder.CreateIndex(
- name: "IX_Transactions_TotalAmount",
- table: "Transactions",
- column: "TotalAmount");
- }
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "AppliedDiscount");
- migrationBuilder.DropTable(
- name: "FuelItems");
- migrationBuilder.DropTable(
- name: "Payment");
- migrationBuilder.DropTable(
- name: "Discounts");
- migrationBuilder.DropTable(
- name: "Transactions");
- }
- }
- }
|