123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- namespace Application.ATG_Classic_App.Migrations
- {
- public partial class init : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Alarms",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- Priority = table.Column<int>(nullable: false),
- TankNumber = table.Column<byte>(nullable: false),
- Type = table.Column<int>(nullable: false),
- Description = table.Column<string>(nullable: true),
- CreatedTimeStamp = table.Column<DateTime>(nullable: false),
- ClearedTimeStamp = table.Column<DateTime>(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Alarms", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "Deliveries",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- TankNumber = table.Column<byte>(nullable: false),
- StartingDateTime = table.Column<DateTime>(nullable: false),
- StartingFuelHeight = table.Column<double>(nullable: false),
- StartingFuelVolume = table.Column<double>(nullable: false),
- StartingFuelTCVolume = table.Column<double>(nullable: false),
- StartingWaterHeight = table.Column<double>(nullable: false),
- StartingWaterVolume = table.Column<double>(nullable: false),
- StartingTemperture = table.Column<double>(nullable: false),
- EndingDateTime = table.Column<DateTime>(nullable: true),
- EndingFuelHeight = table.Column<double>(nullable: true),
- EndingFuelVolume = table.Column<double>(nullable: true),
- EndingFuelTCVolume = table.Column<double>(nullable: true),
- EndingWaterHeight = table.Column<double>(nullable: true),
- EndingWaterVolume = table.Column<double>(nullable: true),
- EndingTemperture = table.Column<double>(nullable: true),
- Description = table.Column<string>(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Deliveries", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "Inventories",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- TankNumber = table.Column<int>(nullable: false),
- TimeStamp = table.Column<DateTime>(nullable: false),
- FuelHeight = table.Column<double>(nullable: false),
- FuelVolume = table.Column<double>(nullable: false),
- FuelTCVolume = table.Column<double>(nullable: false),
- WaterHeight = table.Column<double>(nullable: false),
- Temperture = table.Column<double>(nullable: false),
- Description = table.Column<string>(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Inventories", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "ProbeConfigs",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- CreatedTimeStamp = table.Column<DateTime>(nullable: false),
- ModifiedTimeStamp = table.Column<DateTime>(nullable: true),
- DeviceId = table.Column<int>(nullable: false),
- ProbeOffset = table.Column<double>(nullable: false),
- WaterOffset = table.Column<double>(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_ProbeConfigs", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "ProductConfigs",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- CreatedTimeStamp = table.Column<DateTime>(nullable: false),
- ModifiedTimeStamp = table.Column<DateTime>(nullable: true),
- ProductCode = table.Column<string>(nullable: false),
- ProductLabel = table.Column<string>(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_ProductConfigs", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "TankLimitConfigs",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- CreatedTimeStamp = table.Column<DateTime>(nullable: false),
- ModifiedTimeStamp = table.Column<DateTime>(nullable: true),
- MaxVolume = table.Column<double>(nullable: false),
- FullVolume = table.Column<double>(nullable: false),
- HighProduct = table.Column<double>(nullable: false),
- LowProduct = table.Column<double>(nullable: false),
- HighWaterWarning = table.Column<double>(nullable: false),
- HighWaterAlarm = table.Column<double>(nullable: false),
- FuelTemperatureLowLimit = table.Column<double>(nullable: false),
- FuelTemperatureHighLimit = table.Column<double>(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_TankLimitConfigs", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "TankOverallConfigs",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- CreatedTimeStamp = table.Column<DateTime>(nullable: false),
- ModifiedTimeStamp = table.Column<DateTime>(nullable: true),
- TcReference = table.Column<double>(nullable: false),
- InventorySamplingInterval = table.Column<int>(nullable: false),
- DeliveryMode = table.Column<int>(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_TankOverallConfigs", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "TankConfigs",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- CreatedTimeStamp = table.Column<DateTime>(nullable: false),
- ModifiedTimeStamp = table.Column<DateTime>(nullable: true),
- TankNumber = table.Column<byte>(nullable: false),
- Label = table.Column<string>(nullable: true),
- Diameter = table.Column<double>(nullable: false),
- ThermalCoefficient = table.Column<double>(nullable: false),
- DeliveryDelay = table.Column<int>(nullable: false),
- ProductConfigId = table.Column<int>(nullable: true),
- TankLimitConfigId = table.Column<int>(nullable: true),
- ProbeConfigId = table.Column<int>(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_TankConfigs", x => x.Id);
- table.ForeignKey(
- name: "FK_TankConfigs_ProbeConfigs_ProbeConfigId",
- column: x => x.ProbeConfigId,
- principalTable: "ProbeConfigs",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- table.ForeignKey(
- name: "FK_TankConfigs_ProductConfigs_ProductConfigId",
- column: x => x.ProductConfigId,
- principalTable: "ProductConfigs",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- table.ForeignKey(
- name: "FK_TankConfigs_TankLimitConfigs_TankLimitConfigId",
- column: x => x.TankLimitConfigId,
- principalTable: "TankLimitConfigs",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
- migrationBuilder.CreateTable(
- name: "TankProfileDatas",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- BatchLabel = table.Column<string>(nullable: true),
- TankConfigId = table.Column<int>(nullable: false),
- Height = table.Column<double>(nullable: false),
- Volume = table.Column<double>(nullable: false),
- VolumeChange = table.Column<double>(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_TankProfileDatas", x => x.Id);
- table.ForeignKey(
- name: "FK_TankProfileDatas_TankConfigs_TankConfigId",
- column: x => x.TankConfigId,
- principalTable: "TankConfigs",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- migrationBuilder.CreateIndex(
- name: "IX_Alarms_CreatedTimeStamp",
- table: "Alarms",
- column: "CreatedTimeStamp");
- migrationBuilder.CreateIndex(
- name: "IX_Alarms_TankNumber",
- table: "Alarms",
- column: "TankNumber");
- migrationBuilder.CreateIndex(
- name: "IX_Alarms_TankNumber_Type_Priority_ClearedTimeStamp",
- table: "Alarms",
- columns: new[] { "TankNumber", "Type", "Priority", "ClearedTimeStamp" },
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_Alarms_TankNumber_Type_Priority_CreatedTimeStamp",
- table: "Alarms",
- columns: new[] { "TankNumber", "Type", "Priority", "CreatedTimeStamp" },
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_Deliveries_TankNumber_StartingDateTime",
- table: "Deliveries",
- columns: new[] { "TankNumber", "StartingDateTime" },
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_Inventories_TankNumber_TimeStamp",
- table: "Inventories",
- columns: new[] { "TankNumber", "TimeStamp" },
- unique: true);
- migrationBuilder.CreateIndex(
- name: "IX_TankConfigs_ProbeConfigId",
- table: "TankConfigs",
- column: "ProbeConfigId");
- migrationBuilder.CreateIndex(
- name: "IX_TankConfigs_ProductConfigId",
- table: "TankConfigs",
- column: "ProductConfigId");
- migrationBuilder.CreateIndex(
- name: "IX_TankConfigs_TankLimitConfigId",
- table: "TankConfigs",
- column: "TankLimitConfigId");
- migrationBuilder.CreateIndex(
- name: "IX_TankProfileDatas_TankConfigId",
- table: "TankProfileDatas",
- column: "TankConfigId");
- migrationBuilder.CreateIndex(
- name: "IX_TankProfileDatas_BatchLabel_Height",
- table: "TankProfileDatas",
- columns: new[] { "BatchLabel", "Height" },
- unique: true);
- }
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Alarms");
- migrationBuilder.DropTable(
- name: "Deliveries");
- migrationBuilder.DropTable(
- name: "Inventories");
- migrationBuilder.DropTable(
- name: "TankOverallConfigs");
- migrationBuilder.DropTable(
- name: "TankProfileDatas");
- migrationBuilder.DropTable(
- name: "TankConfigs");
- migrationBuilder.DropTable(
- name: "ProbeConfigs");
- migrationBuilder.DropTable(
- name: "ProductConfigs");
- migrationBuilder.DropTable(
- name: "TankLimitConfigs");
- }
- }
- }
|