skills/bms-mysql-prd/SKILL.md

63 lines
2.4 KiB
Markdown

---
name: bms-mysql-prd
description: Connect to BMS production MySQL database. Use when the user asks to query BMS production database, check production data, or says "查询生产数据库", "查生产数据", "BMS生产库", "BMS正式库". Production database is read-only — any write/DDL will fail.
---
# BMS MySQL 生产数据库连接 Skill
Connect to the BMS production MySQL database for read-only queries.
## Available Databases
| Database | Description |
| ----------------------- | -------------------- |
| `bms_base_center` | 基础数据中心 |
| `bms_buyinvoice_center` | 采购发票中心 |
| `bms_ext_center` | 外部扩展中心 |
| `bms_invoice_center` | 发票中心 |
| `bms_order_center` | 订单中心 |
| `bms_payable_center` | 应付中心 |
| `bms_task_center` | 任务中心 |
| `cache_db` | 缓存数据库 |
| `leshop_v3` | 乐商 V3 |
| `lts` | LTS |
| `manager_db` | 管理数据库 |
| `mq_db` | 消息队列数据库 |
| `sap_push_data` | SAP 推送数据 |
| `sf_db` | SF 数据库 |
| `mysql` | 系统数据库 |
| `information_schema` | 系统信息库 |
## How to Use
Run the helper script with a SQL query:
```bash
python scripts/bms-mysql-prd.py --query "SELECT * FROM bms_base_center.enterprise_info LIMIT 10"
```
## Safety Rules
- **Production is read-only** — the database account only has SELECT permission
- Any `INSERT`/`UPDATE`/`DELETE`/DDL will be rejected by the database
- Write/DDL operations still require a confirmation popup before attempting
- Results are printed in a formatted table
## Script Location
- `scripts/bms-mysql-prd.py` — the execution script (uses PyMySQL)
## Examples
```bash
# Query enterprise info
python scripts/bms-mysql-prd.py --query "SELECT * FROM bms_base_center.enterprise_info WHERE company_code = '7600'"
# List tables in a database
python scripts/bms-mysql-prd.py --query "SHOW TABLES FROM bms_order_center"
```
## Output Format
Results are printed as a formatted table with column headers and aligned values. Empty results show "0 rows returned." Write operations (if attempted) will fail with a permission error.