96 lines
4.4 KiB
C#
96 lines
4.4 KiB
C#
|
|
using System;
|
||
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||
|
|
|
||
|
|
#nullable disable
|
||
|
|
|
||
|
|
namespace TeamUp.Modules.Assembler.Persistence.Migrations
|
||
|
|
{
|
||
|
|
/// <inheritdoc />
|
||
|
|
public partial class InitialAssembler : Migration
|
||
|
|
{
|
||
|
|
/// <inheritdoc />
|
||
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||
|
|
{
|
||
|
|
migrationBuilder.EnsureSchema(
|
||
|
|
name: "assembler");
|
||
|
|
|
||
|
|
migrationBuilder.CreateTable(
|
||
|
|
name: "agent_runs",
|
||
|
|
schema: "assembler",
|
||
|
|
columns: table => new
|
||
|
|
{
|
||
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||
|
|
SeatId = table.Column<Guid>(type: "uuid", nullable: false),
|
||
|
|
WorkItemId = table.Column<Guid>(type: "uuid", nullable: false),
|
||
|
|
AgentId = table.Column<Guid>(type: "uuid", nullable: true),
|
||
|
|
Status = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||
|
|
Prompt = table.Column<string>(type: "text", nullable: true),
|
||
|
|
Output = table.Column<string>(type: "text", nullable: true),
|
||
|
|
ActionType = table.Column<string>(type: "character varying(60)", maxLength: 60, nullable: true),
|
||
|
|
ActionRisk = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true),
|
||
|
|
ResultJson = table.Column<string>(type: "text", nullable: true),
|
||
|
|
Trace = table.Column<string>(type: "text", nullable: true),
|
||
|
|
Error = table.Column<string>(type: "text", nullable: true),
|
||
|
|
LatencyMs = table.Column<long>(type: "bigint", nullable: true),
|
||
|
|
CreatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||
|
|
CompletedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
|
||
|
|
},
|
||
|
|
constraints: table =>
|
||
|
|
{
|
||
|
|
table.PrimaryKey("PK_agent_runs", x => x.Id);
|
||
|
|
});
|
||
|
|
|
||
|
|
migrationBuilder.CreateTable(
|
||
|
|
name: "jobs",
|
||
|
|
schema: "assembler",
|
||
|
|
columns: table => new
|
||
|
|
{
|
||
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||
|
|
Type = table.Column<string>(type: "character varying(60)", maxLength: 60, nullable: false),
|
||
|
|
Payload = table.Column<string>(type: "text", nullable: false),
|
||
|
|
Status = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||
|
|
Attempts = table.Column<int>(type: "integer", nullable: false),
|
||
|
|
LockedBy = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
|
||
|
|
LockedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||
|
|
Error = table.Column<string>(type: "text", nullable: true),
|
||
|
|
CreatedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||
|
|
CompletedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
|
||
|
|
},
|
||
|
|
constraints: table =>
|
||
|
|
{
|
||
|
|
table.PrimaryKey("PK_jobs", x => x.Id);
|
||
|
|
});
|
||
|
|
|
||
|
|
migrationBuilder.CreateIndex(
|
||
|
|
name: "IX_agent_runs_SeatId",
|
||
|
|
schema: "assembler",
|
||
|
|
table: "agent_runs",
|
||
|
|
column: "SeatId");
|
||
|
|
|
||
|
|
migrationBuilder.CreateIndex(
|
||
|
|
name: "IX_agent_runs_WorkItemId",
|
||
|
|
schema: "assembler",
|
||
|
|
table: "agent_runs",
|
||
|
|
column: "WorkItemId");
|
||
|
|
|
||
|
|
migrationBuilder.CreateIndex(
|
||
|
|
name: "IX_jobs_Status_CreatedAtUtc",
|
||
|
|
schema: "assembler",
|
||
|
|
table: "jobs",
|
||
|
|
columns: new[] { "Status", "CreatedAtUtc" });
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <inheritdoc />
|
||
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||
|
|
{
|
||
|
|
migrationBuilder.DropTable(
|
||
|
|
name: "agent_runs",
|
||
|
|
schema: "assembler");
|
||
|
|
|
||
|
|
migrationBuilder.DropTable(
|
||
|
|
name: "jobs",
|
||
|
|
schema: "assembler");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|