Files
zclaw_openfang/crates/zclaw-saas/migrations/20260403000001_accounts_template_assignment.sql
iven de36bb0724
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
fix(saas): migration idempotency fixes + SCHEMA_VERSION bump to 14
- Add IF NOT EXISTS to accounts_template_assignment ALTER COLUMN
- Add IF NOT EXISTS to webhooks CREATE INDEX statements
- Add created_at/updated_at columns + ON CONFLICT DO NOTHING to industry templates
- Bump SCHEMA_VERSION 13→14 to force migration re-run on existing DB
2026-04-05 08:19:10 +08:00

10 lines
440 B
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Phase 1: accounts 表增加 assigned_template_id
-- 用户选择行业模板后记录分配关系,用于跟踪和跳过 onboarding
-- ON DELETE SET NULL: 模板被删除时不影响账户
ALTER TABLE accounts ADD COLUMN IF NOT EXISTS assigned_template_id TEXT
REFERENCES agent_templates(id) ON DELETE SET NULL;
COMMENT ON COLUMN accounts.assigned_template_id IS
'用户选择的行业模板 ID用于跟踪模板分配状态';