| | | 1 | | using Microsoft.EntityFrameworkCore.Migrations; |
| | | 2 | | |
| | | 3 | | #nullable disable |
| | | 4 | | |
| | | 5 | | namespace Elsa.Persistence.EFCore.Sqlite.Migrations.Management |
| | | 6 | | { |
| | | 7 | | /// <inheritdoc /> |
| | | 8 | | public partial class Initial : Migration |
| | | 9 | | { |
| | | 10 | | /// <inheritdoc /> |
| | | 11 | | protected override void Up(MigrationBuilder migrationBuilder) |
| | | 12 | | { |
| | 0 | 13 | | migrationBuilder.CreateTable( |
| | 0 | 14 | | name: "WorkflowDefinitions", |
| | 0 | 15 | | columns: table => new |
| | 0 | 16 | | { |
| | 0 | 17 | | Id = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 18 | | DefinitionId = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 19 | | Name = table.Column<string>(type: "TEXT", nullable: true), |
| | 0 | 20 | | Description = table.Column<string>(type: "TEXT", nullable: true), |
| | 0 | 21 | | ToolVersion = table.Column<string>(type: "TEXT", nullable: true), |
| | 0 | 22 | | ProviderName = table.Column<string>(type: "TEXT", nullable: true), |
| | 0 | 23 | | MaterializerName = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 24 | | MaterializerContext = table.Column<string>(type: "TEXT", nullable: true), |
| | 0 | 25 | | StringData = table.Column<string>(type: "TEXT", nullable: true), |
| | 0 | 26 | | BinaryData = table.Column<byte[]>(type: "BLOB", nullable: true), |
| | 0 | 27 | | IsReadonly = table.Column<bool>(type: "INTEGER", nullable: false), |
| | 0 | 28 | | Data = table.Column<string>(type: "TEXT", nullable: true), |
| | 0 | 29 | | UsableAsActivity = table.Column<bool>(type: "INTEGER", nullable: true), |
| | 0 | 30 | | CreatedAt = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 31 | | Version = table.Column<int>(type: "INTEGER", nullable: false), |
| | 0 | 32 | | IsLatest = table.Column<bool>(type: "INTEGER", nullable: false), |
| | 0 | 33 | | IsPublished = table.Column<bool>(type: "INTEGER", nullable: false) |
| | 0 | 34 | | }, |
| | 0 | 35 | | constraints: table => |
| | 0 | 36 | | { |
| | 0 | 37 | | table.PrimaryKey("PK_WorkflowDefinitions", x => x.Id); |
| | 0 | 38 | | }); |
| | | 39 | | |
| | 0 | 40 | | migrationBuilder.CreateTable( |
| | 0 | 41 | | name: "WorkflowInstances", |
| | 0 | 42 | | columns: table => new |
| | 0 | 43 | | { |
| | 0 | 44 | | Id = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 45 | | DefinitionId = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 46 | | DefinitionVersionId = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 47 | | Version = table.Column<int>(type: "INTEGER", nullable: false), |
| | 0 | 48 | | Status = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 49 | | SubStatus = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 50 | | CorrelationId = table.Column<string>(type: "TEXT", nullable: true), |
| | 0 | 51 | | Name = table.Column<string>(type: "TEXT", nullable: true), |
| | 0 | 52 | | IncidentCount = table.Column<int>(type: "INTEGER", nullable: false), |
| | 0 | 53 | | CreatedAt = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 54 | | UpdatedAt = table.Column<string>(type: "TEXT", nullable: false), |
| | 0 | 55 | | FinishedAt = table.Column<string>(type: "TEXT", nullable: true), |
| | 0 | 56 | | Data = table.Column<string>(type: "TEXT", nullable: true) |
| | 0 | 57 | | }, |
| | 0 | 58 | | constraints: table => |
| | 0 | 59 | | { |
| | 0 | 60 | | table.PrimaryKey("PK_WorkflowInstances", x => x.Id); |
| | 0 | 61 | | }); |
| | | 62 | | |
| | 0 | 63 | | migrationBuilder.CreateIndex( |
| | 0 | 64 | | name: "IX_WorkflowDefinition_DefinitionId_Version", |
| | 0 | 65 | | table: "WorkflowDefinitions", |
| | 0 | 66 | | columns: new[] { "DefinitionId", "Version" }, |
| | 0 | 67 | | unique: true); |
| | | 68 | | |
| | 0 | 69 | | migrationBuilder.CreateIndex( |
| | 0 | 70 | | name: "IX_WorkflowDefinition_IsLatest", |
| | 0 | 71 | | table: "WorkflowDefinitions", |
| | 0 | 72 | | column: "IsLatest"); |
| | | 73 | | |
| | 0 | 74 | | migrationBuilder.CreateIndex( |
| | 0 | 75 | | name: "IX_WorkflowDefinition_IsPublished", |
| | 0 | 76 | | table: "WorkflowDefinitions", |
| | 0 | 77 | | column: "IsPublished"); |
| | | 78 | | |
| | 0 | 79 | | migrationBuilder.CreateIndex( |
| | 0 | 80 | | name: "IX_WorkflowDefinition_Name", |
| | 0 | 81 | | table: "WorkflowDefinitions", |
| | 0 | 82 | | column: "Name"); |
| | | 83 | | |
| | 0 | 84 | | migrationBuilder.CreateIndex( |
| | 0 | 85 | | name: "IX_WorkflowDefinition_UsableAsActivity", |
| | 0 | 86 | | table: "WorkflowDefinitions", |
| | 0 | 87 | | column: "UsableAsActivity"); |
| | | 88 | | |
| | 0 | 89 | | migrationBuilder.CreateIndex( |
| | 0 | 90 | | name: "IX_WorkflowDefinition_Version", |
| | 0 | 91 | | table: "WorkflowDefinitions", |
| | 0 | 92 | | column: "Version"); |
| | | 93 | | |
| | 0 | 94 | | migrationBuilder.CreateIndex( |
| | 0 | 95 | | name: "IX_WorkflowInstance_CorrelationId", |
| | 0 | 96 | | table: "WorkflowInstances", |
| | 0 | 97 | | column: "CorrelationId"); |
| | | 98 | | |
| | 0 | 99 | | migrationBuilder.CreateIndex( |
| | 0 | 100 | | name: "IX_WorkflowInstance_CreatedAt", |
| | 0 | 101 | | table: "WorkflowInstances", |
| | 0 | 102 | | column: "CreatedAt"); |
| | | 103 | | |
| | 0 | 104 | | migrationBuilder.CreateIndex( |
| | 0 | 105 | | name: "IX_WorkflowInstance_DefinitionId", |
| | 0 | 106 | | table: "WorkflowInstances", |
| | 0 | 107 | | column: "DefinitionId"); |
| | | 108 | | |
| | 0 | 109 | | migrationBuilder.CreateIndex( |
| | 0 | 110 | | name: "IX_WorkflowInstance_FinishedAt", |
| | 0 | 111 | | table: "WorkflowInstances", |
| | 0 | 112 | | column: "FinishedAt"); |
| | | 113 | | |
| | 0 | 114 | | migrationBuilder.CreateIndex( |
| | 0 | 115 | | name: "IX_WorkflowInstance_Name", |
| | 0 | 116 | | table: "WorkflowInstances", |
| | 0 | 117 | | column: "Name"); |
| | | 118 | | |
| | 0 | 119 | | migrationBuilder.CreateIndex( |
| | 0 | 120 | | name: "IX_WorkflowInstance_Status", |
| | 0 | 121 | | table: "WorkflowInstances", |
| | 0 | 122 | | column: "Status"); |
| | | 123 | | |
| | 0 | 124 | | migrationBuilder.CreateIndex( |
| | 0 | 125 | | name: "IX_WorkflowInstance_Status_DefinitionId", |
| | 0 | 126 | | table: "WorkflowInstances", |
| | 0 | 127 | | columns: new[] { "Status", "DefinitionId" }); |
| | | 128 | | |
| | 0 | 129 | | migrationBuilder.CreateIndex( |
| | 0 | 130 | | name: "IX_WorkflowInstance_Status_SubStatus", |
| | 0 | 131 | | table: "WorkflowInstances", |
| | 0 | 132 | | columns: new[] { "Status", "SubStatus" }); |
| | | 133 | | |
| | 0 | 134 | | migrationBuilder.CreateIndex( |
| | 0 | 135 | | name: "IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version", |
| | 0 | 136 | | table: "WorkflowInstances", |
| | 0 | 137 | | columns: new[] { "Status", "SubStatus", "DefinitionId", "Version" }); |
| | | 138 | | |
| | 0 | 139 | | migrationBuilder.CreateIndex( |
| | 0 | 140 | | name: "IX_WorkflowInstance_SubStatus", |
| | 0 | 141 | | table: "WorkflowInstances", |
| | 0 | 142 | | column: "SubStatus"); |
| | | 143 | | |
| | 0 | 144 | | migrationBuilder.CreateIndex( |
| | 0 | 145 | | name: "IX_WorkflowInstance_SubStatus_DefinitionId", |
| | 0 | 146 | | table: "WorkflowInstances", |
| | 0 | 147 | | columns: new[] { "SubStatus", "DefinitionId" }); |
| | | 148 | | |
| | 0 | 149 | | migrationBuilder.CreateIndex( |
| | 0 | 150 | | name: "IX_WorkflowInstance_UpdatedAt", |
| | 0 | 151 | | table: "WorkflowInstances", |
| | 0 | 152 | | column: "UpdatedAt"); |
| | 0 | 153 | | } |
| | | 154 | | |
| | | 155 | | /// <inheritdoc /> |
| | | 156 | | protected override void Down(MigrationBuilder migrationBuilder) |
| | | 157 | | { |
| | 0 | 158 | | migrationBuilder.DropTable( |
| | 0 | 159 | | name: "WorkflowDefinitions"); |
| | | 160 | | |
| | 0 | 161 | | migrationBuilder.DropTable( |
| | 0 | 162 | | name: "WorkflowInstances"); |
| | 0 | 163 | | } |
| | | 164 | | } |
| | | 165 | | } |