20200629051222_ProcessorMetaConfigDbModel.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. namespace Edge.Core.Database.Migrations
  4. {
  5. public partial class ProcessorMetaConfigDbModel : Migration
  6. {
  7. protected override void Up(MigrationBuilder migrationBuilder)
  8. {
  9. migrationBuilder.CreateTable(
  10. name: "ProcessorMetaConfigs",
  11. columns: table => new
  12. {
  13. Id = table.Column<int>(nullable: false)
  14. .Annotation("Sqlite:Autoincrement", true),
  15. Name = table.Column<string>(nullable: false),
  16. Description = table.Column<string>(nullable: true),
  17. Type = table.Column<int>(nullable: false),
  18. Activated = table.Column<bool>(nullable: false),
  19. TimeStamp = table.Column<DateTime>(nullable: false)
  20. },
  21. constraints: table =>
  22. {
  23. table.PrimaryKey("PK_ProcessorMetaConfigs", x => x.Id);
  24. });
  25. migrationBuilder.CreateTable(
  26. name: "ProcessorPartsMetaConfigs",
  27. columns: table => new
  28. {
  29. Id = table.Column<int>(nullable: false)
  30. .Annotation("Sqlite:Autoincrement", true),
  31. ProcessorMetaConfigId = table.Column<int>(nullable: false),
  32. Type = table.Column<int>(nullable: false),
  33. FullTypeString = table.Column<string>(nullable: false),
  34. ParametersJsonArrayStr = table.Column<string>(nullable: true)
  35. },
  36. constraints: table =>
  37. {
  38. table.PrimaryKey("PK_ProcessorPartsMetaConfigs", x => x.Id);
  39. table.ForeignKey(
  40. name: "FK_ProcessorPartsMetaConfigs_ProcessorMetaConfigs_ProcessorMetaConfigId",
  41. column: x => x.ProcessorMetaConfigId,
  42. principalTable: "ProcessorMetaConfigs",
  43. principalColumn: "Id",
  44. onDelete: ReferentialAction.Cascade);
  45. });
  46. migrationBuilder.CreateIndex(
  47. name: "IX_ProcessorMetaConfigs_Name",
  48. table: "ProcessorMetaConfigs",
  49. column: "Name",
  50. unique: true);
  51. migrationBuilder.CreateIndex(
  52. name: "IX_ProcessorMetaConfigs_TimeStamp",
  53. table: "ProcessorMetaConfigs",
  54. column: "TimeStamp");
  55. migrationBuilder.CreateIndex(
  56. name: "IX_ProcessorPartsMetaConfigs_ProcessorMetaConfigId_Type",
  57. table: "ProcessorPartsMetaConfigs",
  58. columns: new[] { "ProcessorMetaConfigId", "Type" },
  59. unique: true);
  60. }
  61. protected override void Down(MigrationBuilder migrationBuilder)
  62. {
  63. migrationBuilder.DropTable(
  64. name: "ProcessorPartsMetaConfigs");
  65. migrationBuilder.DropTable(
  66. name: "ProcessorMetaConfigs");
  67. }
  68. }
  69. }