Team Ai
Apppublic

prazy1208/text2sql

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
migration_add_gen_sql_agent_output.sql21 linesDownload Raw Back to scripts
1-- Migration: add app_schema.gen_sql_agent_output (Gen-SQL Agent persistence).2-- Run once on databases created before this table existed.3-- Safe if the table already exists.4 5CREATE TABLE IF NOT EXISTS app_schema.gen_sql_agent_output (6    id                         SERIAL PRIMARY KEY,7    intent_output_id           INT NOT NULL REFERENCES app_schema.intent_agent_output(id) ON DELETE CASCADE,8    generated_sql              TEXT NOT NULL DEFAULT '',9    reasoning_summary          TEXT,10    validation_passed          BOOLEAN NOT NULL DEFAULT FALSE,11    validation_error_codes     TEXT NOT NULL DEFAULT '',12    validation_error_message   TEXT NOT NULL DEFAULT '',13    blocked_keywords           TEXT NOT NULL DEFAULT '',14    is_single_statement        BOOLEAN NOT NULL DEFAULT FALSE,15    is_select_only             BOOLEAN NOT NULL DEFAULT FALSE,16    created_at                 TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,17    UNIQUE (intent_output_id)18);19 20COMMENT ON TABLE app_schema.gen_sql_agent_output IS 'Gen-SQL Agent: generated SQL and validation fields for one intent_agent_output row';21