pipeline_ops/mysql.ddl.sql
yumoqing 17331c770a feat: 修复工作区状态并提交CRUD生成文件
- 修复文件权限 (600→644)
- 删除调试日志 (global_func.py)
- 添加 CRUD 生成的 wwwroot 文件 (pipeline_core/dist/ops)
- 添加 mysql.ddl.sql 文件
- 更新 pyproject.toml 配置
- 添加 showcase 模块安装 (build.sh)
- 更新 index.ui (sidebar toggle + 管理按钮)
- 设置 start.sh/stop.sh 可执行权限
- 添加 wwwroot 符号链接 (appbase/rbac/pipeline_sdlc)
- 更新 .gitignore (排除 pkgs/bricks/pipeline.pid)
2026-08-03 16:20:27 +08:00

117 lines
3.6 KiB
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.

-- models/pipeline_capacity.json
-- 建库时请用以下语句支持emoji字符
-- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
drop table if exists pipeline_capacity;
CREATE TABLE pipeline_capacity
(
`id` VARCHAR(32) NOT NULL comment '主键',
`pipeline_id` VARCHAR(32) NOT NULL comment '产线ID',
`max_concurrent` int comment '最大并发数',
`daily_limit` int comment '每日限额',
`monthly_limit` int comment '每月限额',
`today_usage` int comment '今日用量',
`month_usage` int comment '本月用量',
`status` VARCHAR(20) DEFAULT 'active' comment '状态',
`org_id` VARCHAR(32) DEFAULT '0' comment '所属组织',
`updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '更新时间'
,primary key(id)
)
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci
engine=innodb
comment '产线容量表'
;
CREATE UNIQUE INDEX pipeline_capacity_uk_capacity_pipeline ON pipeline_capacity(pipeline_id);
-- models/pipeline_pricing.json
-- 建库时请用以下语句支持emoji字符
-- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
drop table if exists pipeline_pricing;
CREATE TABLE pipeline_pricing
(
`id` VARCHAR(32) NOT NULL comment '主键',
`pipeline_id` VARCHAR(32) NOT NULL comment '产线ID',
`pricing_type` VARCHAR(20) NOT NULL comment '计费方式',
`unit_price` double(15,4) NOT NULL DEFAULT '0' comment '单价',
`currency` VARCHAR(10) DEFAULT 'CNY' comment '货币',
`pricing_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '定价配置JSON',
`effective_date` date comment '生效日期',
`expiry_date` date comment '失效日期',
`status` VARCHAR(20) DEFAULT 'active' comment '状态',
`org_id` VARCHAR(32) DEFAULT '0' comment '所属组织',
`created_by` VARCHAR(32) comment '创建人',
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '创建时间',
`updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '更新时间'
,primary key(id)
)
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci
engine=innodb
comment '产线定价表'
;
CREATE INDEX pipeline_pricing_idx_pricing_pipeline ON pipeline_pricing(pipeline_id);
CREATE INDEX pipeline_pricing_idx_pricing_status_date ON pipeline_pricing(status,effective_date);
-- models/pipeline_usage_log.json
-- 建库时请用以下语句支持emoji字符
-- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
drop table if exists pipeline_usage_log;
CREATE TABLE pipeline_usage_log
(
`id` VARCHAR(32) NOT NULL comment '主键',
`pipeline_id` VARCHAR(32) NOT NULL comment '产线ID',
`user_id` VARCHAR(32) comment '用户ID',
`distributor_id` VARCHAR(32) comment '分销商ID',
`call_count` int DEFAULT '1' comment '调用次数',
`token_input` int DEFAULT '0' comment '输入Token数',
`token_output` int DEFAULT '0' comment '输出Token数',
`amount` double(15,4) DEFAULT '0' comment '金额',
`status` VARCHAR(20) comment '状态',
`error_message` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '错误信息',
`called_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '调用时间'
,primary key(id)
)
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci
engine=innodb
comment '产线调用日志表'
;
CREATE INDEX pipeline_usage_log_idx_usagelog_pipeline ON pipeline_usage_log(pipeline_id);
CREATE INDEX pipeline_usage_log_idx_usagelog_called_at ON pipeline_usage_log(called_at);
CREATE INDEX pipeline_usage_log_idx_usagelog_distributor ON pipeline_usage_log(distributor_id);