20220830054447_init.cs 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace SuZhou_SIPAC_Client.Migrations
  4. {
  5. public partial class init : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.CreateTable(
  10. name: "InverterAccumulatedDatas",
  11. columns: table => new
  12. {
  13. Id = table.Column<int>(type: "INTEGER", nullable: false)
  14. .Annotation("Sqlite:Autoincrement", true),
  15. 当日有功发电量 = table.Column<decimal>(type: "TEXT", nullable: false),
  16. 当日无功发电量 = table.Column<decimal>(type: "TEXT", nullable: false),
  17. 当月有功发电量 = table.Column<decimal>(type: "TEXT", nullable: true),
  18. 当月无功发电量 = table.Column<decimal>(type: "TEXT", nullable: true),
  19. 当年有功发电量 = table.Column<decimal>(type: "TEXT", nullable: true),
  20. 当年无功发电量 = table.Column<decimal>(type: "TEXT", nullable: true),
  21. CreatedTimeStamp = table.Column<DateTime>(type: "TEXT", nullable: false),
  22. HttpPostResponseReceivedTime = table.Column<DateTime>(type: "TEXT", nullable: true),
  23. HttpPostResponse = table.Column<string>(type: "TEXT", nullable: true)
  24. },
  25. constraints: table =>
  26. {
  27. table.PrimaryKey("PK_InverterAccumulatedDatas", x => x.Id);
  28. });
  29. migrationBuilder.CreateTable(
  30. name: "InverterRealTimeDatas",
  31. columns: table => new
  32. {
  33. Id = table.Column<int>(type: "INTEGER", nullable: false)
  34. .Annotation("Sqlite:Autoincrement", true),
  35. DeviceName = table.Column<string>(type: "TEXT", nullable: true),
  36. DeviceDescription = table.Column<string>(type: "TEXT", nullable: true),
  37. DeviceSlaveAddress = table.Column<int>(type: "INTEGER", nullable: false),
  38. Raw_当日有功发电量 = table.Column<decimal>(type: "TEXT", nullable: false),
  39. Raw_当日无功发电量 = table.Column<decimal>(type: "TEXT", nullable: false),
  40. ReadTimeStamp = table.Column<DateTime>(type: "TEXT", nullable: false),
  41. InverterAccumulatedDataModelId = table.Column<int>(type: "INTEGER", nullable: true)
  42. },
  43. constraints: table =>
  44. {
  45. table.PrimaryKey("PK_InverterRealTimeDatas", x => x.Id);
  46. table.ForeignKey(
  47. name: "FK_InverterRealTimeDatas_InverterAccumulatedDatas_InverterAccumulatedDataModelId",
  48. column: x => x.InverterAccumulatedDataModelId,
  49. principalTable: "InverterAccumulatedDatas",
  50. principalColumn: "Id",
  51. onDelete: ReferentialAction.Restrict);
  52. });
  53. migrationBuilder.CreateIndex(
  54. name: "IX_InverterAccumulatedDatas_Id",
  55. table: "InverterAccumulatedDatas",
  56. column: "Id",
  57. unique: true);
  58. migrationBuilder.CreateIndex(
  59. name: "IX_InverterRealTimeDatas_Id",
  60. table: "InverterRealTimeDatas",
  61. column: "Id",
  62. unique: true);
  63. migrationBuilder.CreateIndex(
  64. name: "IX_InverterRealTimeDatas_InverterAccumulatedDataModelId",
  65. table: "InverterRealTimeDatas",
  66. column: "InverterAccumulatedDataModelId");
  67. migrationBuilder.CreateIndex(
  68. name: "IX_InverterRealTimeDatas_ReadTimeStamp",
  69. table: "InverterRealTimeDatas",
  70. column: "ReadTimeStamp");
  71. }
  72. protected override void Down(MigrationBuilder migrationBuilder)
  73. {
  74. migrationBuilder.DropTable(
  75. name: "InverterRealTimeDatas");
  76. migrationBuilder.DropTable(
  77. name: "InverterAccumulatedDatas");
  78. }
  79. }
  80. }