using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TeamUp.Modules.Assembler.Persistence.Migrations
{
///
public partial class InitialAssembler : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "assembler");
migrationBuilder.CreateTable(
name: "agent_runs",
schema: "assembler",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
SeatId = table.Column(type: "uuid", nullable: false),
WorkItemId = table.Column(type: "uuid", nullable: false),
AgentId = table.Column(type: "uuid", nullable: true),
Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false),
Prompt = table.Column(type: "text", nullable: true),
Output = table.Column(type: "text", nullable: true),
ActionType = table.Column(type: "character varying(60)", maxLength: 60, nullable: true),
ActionRisk = table.Column(type: "character varying(20)", maxLength: 20, nullable: true),
ResultJson = table.Column(type: "text", nullable: true),
Trace = table.Column(type: "text", nullable: true),
Error = table.Column(type: "text", nullable: true),
LatencyMs = table.Column(type: "bigint", nullable: true),
CreatedAtUtc = table.Column(type: "timestamp with time zone", nullable: false),
CompletedAtUtc = table.Column(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(type: "uuid", nullable: false),
Type = table.Column(type: "character varying(60)", maxLength: 60, nullable: false),
Payload = table.Column(type: "text", nullable: false),
Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false),
Attempts = table.Column(type: "integer", nullable: false),
LockedBy = table.Column(type: "character varying(120)", maxLength: 120, nullable: true),
LockedAtUtc = table.Column(type: "timestamp with time zone", nullable: true),
Error = table.Column(type: "text", nullable: true),
CreatedAtUtc = table.Column(type: "timestamp with time zone", nullable: false),
CompletedAtUtc = table.Column(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" });
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "agent_runs",
schema: "assembler");
migrationBuilder.DropTable(
name: "jobs",
schema: "assembler");
}
}
}