| | | 1 | | using Microsoft.EntityFrameworkCore.Migrations; |
| | | 2 | | |
| | | 3 | | #nullable disable |
| | | 4 | | |
| | | 5 | | namespace Elsa.AI.Persistence.EFCore.Migrations; |
| | | 6 | | |
| | | 7 | | public partial class Initial : Migration |
| | | 8 | | { |
| | | 9 | | protected override void Up(MigrationBuilder migrationBuilder) |
| | | 10 | | { |
| | 32 | 11 | | migrationBuilder.CreateTable( |
| | 32 | 12 | | name: "AIAuditRecords", |
| | 32 | 13 | | columns: table => new |
| | 32 | 14 | | { |
| | 32 | 15 | | Id = table.Column<string>(nullable: false), |
| | 32 | 16 | | TenantId = table.Column<string>(nullable: true), |
| | 32 | 17 | | ActorId = table.Column<string>(nullable: false), |
| | 32 | 18 | | ConversationId = table.Column<string>(nullable: true), |
| | 32 | 19 | | ProposalId = table.Column<string>(nullable: true), |
| | 32 | 20 | | ToolInvocationId = table.Column<string>(nullable: true), |
| | 32 | 21 | | Type = table.Column<string>(nullable: false), |
| | 32 | 22 | | Timestamp = table.Column<DateTimeOffset>(nullable: false), |
| | 32 | 23 | | TraceId = table.Column<string>(nullable: true), |
| | 32 | 24 | | Summary = table.Column<string>(nullable: false), |
| | 32 | 25 | | Data = table.Column<string>(nullable: false) |
| | 32 | 26 | | }, |
| | 32 | 27 | | constraints: table => |
| | 32 | 28 | | { |
| | 32 | 29 | | table.PrimaryKey("PK_AIAuditRecords", x => x.Id); |
| | 64 | 30 | | }); |
| | | 31 | | |
| | 32 | 32 | | migrationBuilder.CreateTable( |
| | 32 | 33 | | name: "AIConversations", |
| | 32 | 34 | | columns: table => new |
| | 32 | 35 | | { |
| | 32 | 36 | | Id = table.Column<string>(nullable: false), |
| | 32 | 37 | | TenantId = table.Column<string>(nullable: true), |
| | 32 | 38 | | UserId = table.Column<string>(nullable: false), |
| | 32 | 39 | | Title = table.Column<string>(nullable: true), |
| | 32 | 40 | | Status = table.Column<string>(nullable: false), |
| | 32 | 41 | | CreatedAt = table.Column<DateTimeOffset>(nullable: false), |
| | 32 | 42 | | UpdatedAt = table.Column<DateTimeOffset>(nullable: false), |
| | 32 | 43 | | ProviderSessionId = table.Column<string>(nullable: true), |
| | 32 | 44 | | RetentionMode = table.Column<string>(nullable: false), |
| | 32 | 45 | | RetentionExpiresAt = table.Column<DateTimeOffset>(nullable: true), |
| | 32 | 46 | | Messages = table.Column<string>(nullable: false) |
| | 32 | 47 | | }, |
| | 32 | 48 | | constraints: table => |
| | 32 | 49 | | { |
| | 32 | 50 | | table.PrimaryKey("PK_AIConversations", x => x.Id); |
| | 64 | 51 | | }); |
| | | 52 | | |
| | 32 | 53 | | migrationBuilder.CreateTable( |
| | 32 | 54 | | name: "AIProposals", |
| | 32 | 55 | | columns: table => new |
| | 32 | 56 | | { |
| | 32 | 57 | | Id = table.Column<string>(nullable: false), |
| | 32 | 58 | | TenantId = table.Column<string>(nullable: true), |
| | 32 | 59 | | ConversationId = table.Column<string>(nullable: false), |
| | 32 | 60 | | Kind = table.Column<string>(nullable: false), |
| | 32 | 61 | | Status = table.Column<string>(nullable: false), |
| | 32 | 62 | | BaselineWorkflowDefinitionId = table.Column<string>(nullable: true), |
| | 32 | 63 | | BaselineVersionId = table.Column<string>(nullable: true), |
| | 32 | 64 | | WorkflowPayload = table.Column<string>(nullable: false), |
| | 32 | 65 | | Rationale = table.Column<string>(nullable: false), |
| | 32 | 66 | | Warnings = table.Column<string>(nullable: false), |
| | 32 | 67 | | ValidationDiagnostics = table.Column<string>(nullable: false), |
| | 32 | 68 | | GraphDiff = table.Column<string>(nullable: true), |
| | 32 | 69 | | CreatedBy = table.Column<string>(nullable: false), |
| | 32 | 70 | | CreatedAt = table.Column<DateTimeOffset>(nullable: false), |
| | 32 | 71 | | ReviewedBy = table.Column<string>(nullable: true), |
| | 32 | 72 | | ReviewedAt = table.Column<DateTimeOffset>(nullable: true), |
| | 32 | 73 | | AppliedBy = table.Column<string>(nullable: true), |
| | 32 | 74 | | AppliedAt = table.Column<DateTimeOffset>(nullable: true) |
| | 32 | 75 | | }, |
| | 32 | 76 | | constraints: table => |
| | 32 | 77 | | { |
| | 32 | 78 | | table.PrimaryKey("PK_AIProposals", x => x.Id); |
| | 64 | 79 | | }); |
| | | 80 | | |
| | 32 | 81 | | migrationBuilder.CreateIndex( |
| | 32 | 82 | | name: "IX_AIAuditRecords_ProposalId", |
| | 32 | 83 | | table: "AIAuditRecords", |
| | 32 | 84 | | column: "ProposalId"); |
| | | 85 | | |
| | 32 | 86 | | migrationBuilder.CreateIndex( |
| | 32 | 87 | | name: "IX_AIAuditRecords_ActorId", |
| | 32 | 88 | | table: "AIAuditRecords", |
| | 32 | 89 | | column: "ActorId"); |
| | | 90 | | |
| | 32 | 91 | | migrationBuilder.CreateIndex( |
| | 32 | 92 | | name: "IX_AIAuditRecords_TenantId_Timestamp", |
| | 32 | 93 | | table: "AIAuditRecords", |
| | 32 | 94 | | columns: new[] { "TenantId", "Timestamp" }); |
| | | 95 | | |
| | 32 | 96 | | migrationBuilder.CreateIndex( |
| | 32 | 97 | | name: "IX_AIAuditRecords_TenantId_ConversationId", |
| | 32 | 98 | | table: "AIAuditRecords", |
| | 32 | 99 | | columns: new[] { "TenantId", "ConversationId" }); |
| | | 100 | | |
| | 32 | 101 | | migrationBuilder.CreateIndex( |
| | 32 | 102 | | name: "IX_AIAuditRecords_ToolInvocationId", |
| | 32 | 103 | | table: "AIAuditRecords", |
| | 32 | 104 | | column: "ToolInvocationId"); |
| | | 105 | | |
| | 32 | 106 | | migrationBuilder.CreateIndex( |
| | 32 | 107 | | name: "IX_AIConversations_RetentionExpiresAt", |
| | 32 | 108 | | table: "AIConversations", |
| | 32 | 109 | | column: "RetentionExpiresAt"); |
| | | 110 | | |
| | 32 | 111 | | migrationBuilder.CreateIndex( |
| | 32 | 112 | | name: "IX_AIConversations_Status", |
| | 32 | 113 | | table: "AIConversations", |
| | 32 | 114 | | column: "Status"); |
| | | 115 | | |
| | 32 | 116 | | migrationBuilder.CreateIndex( |
| | 32 | 117 | | name: "IX_AIConversations_TenantId_UserId", |
| | 32 | 118 | | table: "AIConversations", |
| | 32 | 119 | | columns: new[] { "TenantId", "UserId" }); |
| | | 120 | | |
| | 32 | 121 | | migrationBuilder.CreateIndex( |
| | 32 | 122 | | name: "IX_AIProposals_Status", |
| | 32 | 123 | | table: "AIProposals", |
| | 32 | 124 | | column: "Status"); |
| | | 125 | | |
| | 32 | 126 | | migrationBuilder.CreateIndex( |
| | 32 | 127 | | name: "IX_AIProposals_TenantId_ConversationId", |
| | 32 | 128 | | table: "AIProposals", |
| | 32 | 129 | | columns: new[] { "TenantId", "ConversationId" }); |
| | 32 | 130 | | } |
| | | 131 | | |
| | | 132 | | protected override void Down(MigrationBuilder migrationBuilder) |
| | | 133 | | { |
| | 0 | 134 | | migrationBuilder.DropTable(name: "AIAuditRecords"); |
| | 0 | 135 | | migrationBuilder.DropTable(name: "AIConversations"); |
| | 0 | 136 | | migrationBuilder.DropTable(name: "AIProposals"); |
| | 0 | 137 | | } |
| | | 138 | | } |