gitdataai/libs/migrate/sql/agent_task/agent_task_up_01.sql
ZhenYi b413edccaf refactor(migrate): replace hand-written migrations with SQL-file macro system
Replace individual Rust migration modules with a define_sql_migrations
macro that reads up/down SQL files via include_str!. Consolidate all
legacy single-file SQL into per-table directories and add full schema
migration coverage for 90+ tables.
2026-05-18 20:42:47 +08:00

46 lines
1.6 KiB
SQL

create table if not exists agent_task
(
id bigserial
primary key,
project_uuid uuid not null,
parent_id bigint
constraint fk_agent_task_parent
references agent_task
on delete set null,
agent_type varchar(20) default 'react'::character varying not null,
status varchar(20) default 'pending'::character varying not null,
title varchar(255),
input text not null,
output text,
error text,
created_by uuid,
created_at timestamp with time zone default now() not null,
updated_at timestamp with time zone default now() not null,
started_at timestamp with time zone,
done_at timestamp with time zone,
progress varchar(255),
issue_id uuid,
retry_count integer default 0
);
create index if not exists idx_agent_task_project
on agent_task (project_uuid);
create index if not exists idx_agent_task_parent
on agent_task (parent_id);
create index if not exists idx_agent_task_status
on agent_task (status);
create index if not exists idx_agent_task_created_by
on agent_task (created_by);
create index if not exists idx_agent_task_created_at
on agent_task (created_at);
create index if not exists idx_agent_task_issue
on agent_task (issue_id);
create index if not exists idx_agent_task_retry_count
on agent_task (retry_count);