Files
lindyson-ai/apps/api/migrations/010_provider_usage_units.sql
Juno ChowandClaude Fable 5.1 f665082dad chore: 建立产品仓库,完成开源前的敏感信息清理
前端(Vite + React)、API/worker(Fastify + BullMQ)、api-contracts 契约包、
迁移脚本、测试与自托管 docker-compose 示例。

开源准备:运维脚本与机器信息已拆到私有仓库;公司名、备案号、隐私邮箱改读
publicCompliance.local.json(仓库只保留占位模板);站点地址与客服二维码改为
VITE_ 环境变量;fixtures 中的真实用户标识已匿名化;三个 package.json 标注
Apache-2.0。

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-16 02:10:46 +08:00

20 lines
617 B
SQL

ALTER TABLE provider_usage_records
ADD COLUMN IF NOT EXISTS usage_unit text;
UPDATE provider_usage_records
SET usage_unit = 'legacy-credit'
WHERE usage_unit IS NULL OR usage_unit = '';
ALTER TABLE provider_usage_records
ALTER COLUMN usage_unit SET DEFAULT 'legacy-credit';
ALTER TABLE provider_usage_records
ALTER COLUMN usage_unit SET NOT NULL;
ALTER TABLE provider_usage_records
DROP CONSTRAINT IF EXISTS provider_usage_records_usage_unit_check;
ALTER TABLE provider_usage_records
ADD CONSTRAINT provider_usage_records_usage_unit_check
CHECK (usage_unit IN ('tokens', 'credits', 'legacy-credit'));