20210625080336_AddGenericAlarms.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace Edge.Core.Database.Migrations
  4. {
  5. public partial class AddGenericAlarms : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.CreateTable(
  10. name: "GenericAlarms",
  11. columns: table => new
  12. {
  13. Id = table.Column<int>(type: "INTEGER", nullable: false)
  14. .Annotation("Sqlite:Autoincrement", true),
  15. ProcessorEndpointFullTypeStr = table.Column<string>(type: "TEXT", nullable: true),
  16. OriginatorDisplayName = table.Column<string>(type: "TEXT", nullable: true),
  17. Title = table.Column<string>(type: "TEXT", nullable: true),
  18. Detail = table.Column<string>(type: "TEXT", nullable: true),
  19. Category = table.Column<string>(type: "TEXT", nullable: true),
  20. SubCategory = table.Column<string>(type: "TEXT", nullable: true),
  21. HiddenData = table.Column<string>(type: "TEXT", nullable: true),
  22. Action = table.Column<string>(type: "TEXT", nullable: true),
  23. Severity = table.Column<int>(type: "INTEGER", nullable: false),
  24. OpeningTimestamp = table.Column<DateTime>(type: "TEXT", nullable: false),
  25. AckedReason = table.Column<string>(type: "TEXT", nullable: true),
  26. AckedTimestamp = table.Column<DateTime>(type: "TEXT", nullable: true),
  27. ClosedReason = table.Column<string>(type: "TEXT", nullable: true),
  28. ClosedTimestamp = table.Column<DateTime>(type: "TEXT", nullable: true)
  29. },
  30. constraints: table =>
  31. {
  32. table.PrimaryKey("PK_GenericAlarms", x => x.Id);
  33. });
  34. migrationBuilder.CreateIndex(
  35. name: "IX_GenericAlarms_Category_SubCategory",
  36. table: "GenericAlarms",
  37. columns: new[] { "Category", "SubCategory" });
  38. migrationBuilder.CreateIndex(
  39. name: "IX_GenericAlarms_ClosedTimestamp",
  40. table: "GenericAlarms",
  41. column: "ClosedTimestamp");
  42. migrationBuilder.CreateIndex(
  43. name: "IX_GenericAlarms_HiddenData",
  44. table: "GenericAlarms",
  45. column: "HiddenData");
  46. migrationBuilder.CreateIndex(
  47. name: "IX_GenericAlarms_OpeningTimestamp",
  48. table: "GenericAlarms",
  49. column: "OpeningTimestamp");
  50. migrationBuilder.CreateIndex(
  51. name: "IX_GenericAlarms_OriginatorDisplayName_OpeningTimestamp_ClosedTimestamp",
  52. table: "GenericAlarms",
  53. columns: new[] { "OriginatorDisplayName", "OpeningTimestamp", "ClosedTimestamp" });
  54. migrationBuilder.CreateIndex(
  55. name: "IX_GenericAlarms_ProcessorEndpointFullTypeStr",
  56. table: "GenericAlarms",
  57. column: "ProcessorEndpointFullTypeStr");
  58. migrationBuilder.CreateIndex(
  59. name: "IX_GenericAlarms_Severity",
  60. table: "GenericAlarms",
  61. column: "Severity");
  62. }
  63. protected override void Down(MigrationBuilder migrationBuilder)
  64. {
  65. migrationBuilder.DropTable(
  66. name: "GenericAlarms");
  67. }
  68. }
  69. }