Blame · Line-by-line history
0037_marketplace_agent_listings.sql
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 055ebc4 | 1 | -- Block K10 — Agent marketplace listings. |
| 2 | -- Publisher-curated directory of installable K-agents. Each listing references | |
| 3 | -- an existing agent app/bot (from Block H/K2) so installs reuse the mature | |
| 4 | -- agent-identity flow (`installAgentForRepo`, `issueAgentToken`, `uninstallAgent`). | |
| 5 | ||
| 6 | CREATE TABLE IF NOT EXISTS marketplace_agent_listings ( | |
| 7 | id uuid PRIMARY KEY DEFAULT gen_random_uuid(), | |
| 8 | slug text NOT NULL UNIQUE, | |
| 9 | name text NOT NULL, | |
| 10 | tagline text NOT NULL, | |
| 11 | description text NOT NULL DEFAULT '', | |
| 12 | publisher_user_id uuid REFERENCES users(id) ON DELETE SET NULL, | |
| 13 | app_bot_id uuid NOT NULL REFERENCES app_bots(id) ON DELETE CASCADE, | |
| 14 | kind text NOT NULL, -- one of: triage, fix, review, heal_bot, deploy_watch, custom | |
| 15 | homepage_url text, | |
| 16 | icon_url text, | |
| 17 | pricing_cents_per_month integer NOT NULL DEFAULT 0, | |
| 18 | published boolean NOT NULL DEFAULT false, | |
| 19 | install_count integer NOT NULL DEFAULT 0, | |
| 20 | created_at timestamptz NOT NULL DEFAULT now(), | |
| 21 | updated_at timestamptz NOT NULL DEFAULT now() | |
| 22 | ); | |
| 23 | ||
| 24 | CREATE INDEX IF NOT EXISTS marketplace_agent_listings_published_idx | |
| 25 | ON marketplace_agent_listings (published, install_count DESC); | |
| 26 | ||
| 27 | CREATE INDEX IF NOT EXISTS marketplace_agent_listings_publisher_idx | |
| 28 | ON marketplace_agent_listings (publisher_user_id); |