# SaaS 库电商运营字段数据字典

> 生成于 2026-09-24 · `tools/gen_data_dictionary.py` 从 information_schema 实时导出 × 业务语义注释
> · 共 115 表 / 1230 列 · 口径注释来自代码与数据链路文档
> · 列含义优先级: 表专列注释 > 通用词根词典 > 字段名自明

## 🛒 订单与销量

### `amazon_orders` — 订单主表(ingest: mercury 三品牌统一 28 列口径; 翻日=北京时间)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `amazon_order_id` | character varying | Amazon 订单号 |
| `country` | character varying | 国家/站点 |
| `purchase_date` | date | 下单日(北京时间翻日, 源 timestamptz 在摄取时折算) |
| `shipped_date` | date | 发货日 |
| `order_status` | character varying | 原始状态(Shipped/Canceled/Pending...) |
| `status_cn` | text | 中文状态 |
| `fulfillment_channel` | character varying | 履约渠道(AFN=FBA) |
| `is_prime` | boolean | Prime 单 |
| `items_count` | integer | 件数(缺省兜底看 sku_list) |
| `currency` | character varying | 币种(ISO) |
| `local_amount` | numeric | 本币订单金额 |
| `revenue_usd` | numeric | 营收折 USD |
| `net_usd` | numeric | 净利(结算回填, 滞后约2周) |
| `commission_usd` | numeric | 佣金(USD) |
| `fba_usd` | numeric | FBA 费(USD) |
| `other_fees_usd` | numeric | 其他费(USD) |
| `promo_usd` | numeric | 促销费(USD) |
| `margin_pct` | numeric | 毛利率% |
| `has_refund` | boolean | 有退款事件 |
| `refund_count` | bigint |  |
| `has_finance` | boolean | 有结算事件(结算滞后可视化的信号源) |
| `settlement_status` | text | 回款状态(已回款/待回款...) |
| `days_waiting` | integer | 待回款天数 |
| `is_abnormal` | boolean | 回款异常(>14天) |
| `sku_list` | text | SKU 清单(逗号分隔) |
| `asin_list` | text |  |
| `sales_channel` | text | 销售渠道 |
| `overhead_usd` | numeric | 摊销 overhead(mercury 口径) |

### `sales_hourly` — 小时销量(品牌×国家×日×小时, ingest 派生自订单; 今日页 24h 图数据源)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `country` | text | 国家/站点 |
| `day` | date | 日(口径随表: 订单系=北京时间, 广告系=Amazon 站点日) |
| `hour` | smallint | 小时(北京时间) |
| `orders` | integer | 该小时单量 |

### `sales_daily` — SKU×日销量与广告关联(营收/广告花费/广告销售三线对齐)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `day` | date | 日(口径随表: 订单系=北京时间, 广告系=Amazon 站点日) |
| `units` | integer | 件数 |
| `revenue` | numeric | 营收 |
| `ad_spend` | numeric |  |
| `ad_sales` | numeric |  |
| `sessions` | integer |  |

### `products`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `title` | text | 标题 |
| `category` | text |  |
| `price` | numeric |  |
| `cost` | numeric |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `attrs` | jsonb |  |

### `product_categories`

| 列 | 类型 | 含义 |
|---|---|---|
| `category` | text |  |
| `name` | text | 名称 |
| `attr_schema` | jsonb |  |
| `sort` | integer |  |

## 💰 财务与结算

### `finance_monthly` — 月度财务(SKU×市场×月: 本币四件套+USD 口径, 对账口径表)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `marketplace` | text | 市场 |
| `mon` | text | 月(YYYY-MM) |
| `orders` | integer | 订单数 |
| `units` | integer | 件数 |
| `currency` | text | 币种(ISO) |
| `local_revenue` | numeric | 本币营收 |
| `local_fees` | numeric | 本币费用(abs) |
| `local_net` | numeric | 本币净额 |
| `revenue_usd` | numeric | 营收折 USD |
| `net_profit_usd` | numeric | 净利 USD |
| `commission_usd` | numeric |  |
| `fba_usd` | numeric |  |
| `promo_usd` | numeric |  |
| `price_per_unit_usd` | numeric | 单件净利 USD |
| `profit_per_unit_usd` | numeric | 单件利润 USD |
| `margin_pct` | numeric | 利润率% |

### `order_fees` — 逐单费用(本币 abs 口径+USD 折算; 图表墙财务组依据)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `amazon_order_id` | text |  |
| `currency` | text | 币种(ISO) |
| `commission` | double precision |  |
| `fba` | double precision |  |
| `promo` | double precision |  |
| `other` | double precision |  |
| `total` | double precision | 费用合计(权威口径, 含四项外成分) |
| `local_commission` | numeric | 本币佣金(abs) |
| `local_fba` | numeric | 本币 FBA(abs) |
| `local_promo` | numeric | 本币促销(abs) |
| `local_other` | numeric | 本币其他(abs) |

### `amazon_settlement_monthly` — 月度回款(结算单折 USD 汇总)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `mon` | text | 月(YYYY-MM) |
| `payout_usd` | numeric |  |

### `amazon_refund_monthly` — 月度退货件数(SKU 级)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `mon` | text | 月(YYYY-MM) |
| `units` | integer | 件数 |

### `monthly_pl` — 月度损益表(品牌×项目×月: 营收/佣金/尾程/VAT/净利 16 列)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `project` | text |  |
| `mon` | text | 月(YYYY-MM) |
| `revenue` | numeric | 营收 |
| `refund` | numeric |  |
| `commission` | numeric |  |
| `delivery` | numeric |  |
| `vat` | numeric |  |
| `other_fees` | numeric |  |
| `net_profit` | numeric |  |
| `statement_total` | numeric |  |
| `settlement_total` | numeric |  |
| `payment_total` | numeric |  |
| `order_count` | integer |  |
| `refund_count` | integer |  |
| `ad_cost` | numeric |  |

### `fx_rates` — 汇率日表(11 币种; 全站本土货币框架基准)

| 列 | 类型 | 含义 |
|---|---|---|
| `cur` | text |  |
| `rate_date` | date |  |
| `usd_rate` | numeric |  |
| `source` | text |  |

## 📣 广告与投放

### `ads_sku_daily` — 广告 SKU 日报表(12 列含本币双轨; 消费方须排除 onno 防双计)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `country` | text | 国家/站点 |
| `day` | date | 日(口径随表: 订单系=北京时间, 广告系=Amazon 站点日) |
| `impressions` | bigint | 曝光 |
| `clicks` | bigint | 点击 |
| `spend` | numeric | 广告花费(USD) |
| `sales` | numeric | 广告销售(USD) |
| `orders` | bigint | 订单数 |
| `local_spend` | numeric | 本币花费(不折算) |
| `local_sales` | numeric | 本币销售(不折算) |
| `currency` | text | 币种(ISO) |

### `ads_daily` — 广告日报表(国家×日 7 指标)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `country` | text | 国家/站点 |
| `day` | date | 日(口径随表: 订单系=北京时间, 广告系=Amazon 站点日) |
| `impressions` | bigint | 曝光 |
| `clicks` | bigint | 点击 |
| `add_to_list` | bigint |  |
| `spend` | numeric | 广告花费(USD) |
| `orders` | integer | 订单数 |
| `sales` | numeric | 广告销售(USD) |
| `cross_sales` | numeric |  |

### `ad_campaigns` — 广告活动 30 天快照

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `brand` | text | 品牌 |
| `name` | text | 名称 |
| `platform` | text | 平台(amazon/noon) |
| `state` | text | 状态 |
| `spend_30d` | numeric |  |
| `sales_30d` | numeric |  |
| `clicks_30d` | integer |  |
| `impressions_30d` | integer |  |
| `country` | text | 国家/站点 |

### `amazon_ads_daily` — onno Amazon 广告日数据(独立表, 与 ads_sku_daily 同源不同构)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `brand` | text | 品牌 |
| `day` | date | 日(口径随表: 订单系=北京时间, 广告系=Amazon 站点日) |
| `country` | text | 国家/站点 |
| `currency` | text | 币种(ISO) |
| `campaign_name` | text |  |
| `campaign_id` | text |  |
| `ad_group` | text |  |
| `advertised_asin` | text |  |
| `advertised_sku` | text |  |
| `ad_cost` | numeric |  |
| `ad_sales` | numeric |  |
| `ad_sales_7d` | numeric |  |
| `clicks` | integer | 点击 |
| `impressions` | integer | 曝光 |
| `purchases` | integer |  |
| `units` | integer | 件数 |
| `local_spend` | numeric |  |
| `local_sales` | numeric |  |

### `ads_search_terms_daily` — 广告搜索词日报(收割/否定规则引擎数据源)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `platform` | text | 平台(amazon/noon) |
| `country` | text | 国家/站点 |
| `day` | date | 日(口径随表: 订单系=北京时间, 广告系=Amazon 站点日) |
| `campaign_name` | text |  |
| `ad_group` | text |  |
| `term` | text |  |
| `keyword` | text |  |
| `impressions` | bigint | 曝光 |
| `clicks` | bigint | 点击 |
| `spend` | numeric | 广告花费(USD) |
| `sales` | numeric | 广告销售(USD) |
| `orders` | bigint | 订单数 |

### `ads_keywords_daily` — 广告关键词/投放目标日报(含出价; 收割收录判断)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `platform` | text | 平台(amazon/noon) |
| `country` | text | 国家/站点 |
| `day` | date | 日(口径随表: 订单系=北京时间, 广告系=Amazon 站点日) |
| `campaign_name` | text |  |
| `ad_group` | text |  |
| `keyword` | text |  |
| `match_type` | text |  |
| `bid` | numeric |  |
| `status` | text | 状态 |
| `impressions` | bigint | 曝光 |
| `clicks` | bigint | 点击 |
| `spend` | numeric | 广告花费(USD) |
| `sales` | numeric | 广告销售(USD) |
| `orders` | bigint | 订单数 |

### `ads_recommendations` — 规则引擎建议(9 类规则×3 窗口; pending→人工决策→执行闭环)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `run_date` | date |  |
| `brand` | text | 品牌 |
| `platform` | text | 平台(amazon/noon) |
| `win` | text | 窗口(1d/3d/7d/30d) |
| `rule` | text | 规则类型(9 类) |
| `target_type` | text | 目标类型(search_term/keyword/campaign) |
| `target_key` | text | 目标键(词/活动名) |
| `country` | text | 国家/站点 |
| `detail` | jsonb | 规则数据(jsonb) |
| `action` | text | 建议动作 |
| `reason` | text | 决策依据(文案) |
| `status` | text | 状态 |
| `user_note` | text | 人工备注 |
| `modified_action` | text | 人工修改后动作 |
| `decided_at` | timestamp with time zone | 决策时间 |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `executed_at` | timestamp with time zone | 执行时间 |
| `execution_result` | text | 执行结果 |

### `ads_rule_config` — 规则引擎参数注册表(品牌级覆盖全局; 阈值改表不改码)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `brand` | text | 品牌 |
| `grp` | text |  |
| `key` | text |  |
| `value` | text |  |
| `label` | text |  |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

### `ads_optimization_log` — 广告优化执行日志(mercury agent 执行回流; 人工反馈列不被日更覆盖)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `id` | bigint |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `platform` | text | 平台(amazon/noon) |
| `country` | text | 国家/站点 |
| `campaign_id` | text |  |
| `campaign_name` | text |  |
| `action_type` | text |  |
| `action_detail` | text |  |
| `reason` | text |  |
| `status` | text | 状态 |
| `is_read` | boolean |  |
| `executed_by` | text |  |
| `product` | text |  |
| `asin` | text | Amazon ASIN |
| `source` | text |  |
| `suggested_action` | jsonb |  |
| `user_status` | text |  |
| `user_feedback` | text |  |
| `user_feedback_at` | timestamp with time zone |  |
| `user_feedback_by` | text |  |
| `user_decision` | text |  |
| `executed_at` | timestamp with time zone |  |
| `execution_result` | text |  |
| `extra_info` | jsonb |  |

### `ads_decision_request`

| 列 | 类型 | 含义 |
|---|---|---|
| `idempotency_key` | character varying |  |
| `tenant_id` | bigint | 租户 ID |
| `request_hash` | character |  |
| `rid` | bigint |  |
| `decision_by` | character varying |  |
| `status` | character varying | 状态 |
| `request_json` | jsonb |  |
| `response_json` | jsonb |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `finished_at` | timestamp with time zone |  |

### `ads_decision_audit`

| 列 | 类型 | 含义 |
|---|---|---|
| `event_id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `idempotency_key` | character varying |  |
| `event_type` | character varying |  |
| `rid` | bigint |  |
| `actor` | character varying |  |
| `event_json` | jsonb |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

## 📦 库存与采购

### `inventory_health` — 库存健康(销速/可售天数/状态: 断货/低库存/正常/充足)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `marketplace` | text | 市场/站点名 |
| `asin` | text | Amazon ASIN |
| `fnsku` | text | FNSKU |
| `total_qty` | integer |  |
| `good_qty` | integer | 可售 |
| `reserved` | integer | 预留 |
| `inbound` | integer | 在途 |
| `bad_qty` | integer | 不可售 |
| `daily_sales` | numeric | 日销速 |
| `stock_days` | numeric | 可售天数 |
| `stock_status` | text | 库存状态 |
| `last_updated` | timestamp with time zone |  |

### `inv_products`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `sku` | text | 卖家 SKU |
| `product_name` | text |  |
| `standard_cost` | numeric |  |
| `reorder_point` | numeric |  |
| `reorder_qty` | numeric |  |
| `safety_stock` | numeric |  |
| `enabled` | boolean | 启用开关 |
| `remark` | text |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `inv_warehouses`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `code` | text |  |
| `name` | text | 名称 |
| `kind` | text |  |
| `platform` | text | 平台(amazon/noon) |
| `enabled` | boolean | 启用开关 |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `inv_stock_balance`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `sku` | text | 卖家 SKU |
| `product_name` | text |  |
| `warehouse_id` | bigint |  |
| `on_hand` | numeric |  |
| `in_transit` | numeric |  |
| `reserved` | numeric |  |
| `avg_cost` | numeric |  |
| `total_cost` | numeric |  |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

### `inv_stock_ledger`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `sku` | text | 卖家 SKU |
| `warehouse_id` | bigint |  |
| `qty_change` | numeric |  |
| `qty_after` | numeric |  |
| `unit_cost` | numeric |  |
| `doc_type` | text |  |
| `doc_no` | text |  |
| `note` | text | 说明 |
| `created_by` | bigint |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `inv_doc_heads`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `doc_no` | text |  |
| `doc_type` | text |  |
| `status` | text | 状态 |
| `ref_no` | text |  |
| `ref_id` | bigint |  |
| `warehouse_id` | bigint |  |
| `target_warehouse_id` | bigint |  |
| `supplier_id` | bigint |  |
| `doc_date` | date |  |
| `adj_sign` | integer |  |
| `remark` | text |  |
| `total_amount` | numeric |  |
| `create_by` | bigint |  |
| `approve_by` | bigint |  |
| `approve_at` | timestamp with time zone |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `inv_doc_items`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `doc_id` | bigint |  |
| `sku` | text | 卖家 SKU |
| `product_name` | text |  |
| `qty` | numeric | 数量 |
| `count_qty` | numeric |  |
| `unit_price` | numeric |  |
| `amount` | numeric |  |
| `remark` | text |  |
| `batch_no` | text |  |
| `serial_no` | text |  |

### `purchase_orders`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `po_no` | text |  |
| `supplier_id` | bigint |  |
| `status` | text | 状态 |
| `dest_market` | text |  |
| `notes` | text |  |
| `total_cost_rmb` | numeric |  |
| `created_by` | bigint |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |
| `pdf_path` | text |  |
| `mail_status` | text |  |
| `mail_to` | text |  |
| `mailed_at` | timestamp with time zone |  |

### `purchase_order_items`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `po_id` | bigint |  |
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `asin` | text | Amazon ASIN |
| `marketplace` | text | 市场/站点名 |
| `qty_ordered` | integer |  |
| `unit_cost_rmb` | numeric |  |
| `qty_received` | integer |  |

### `suppliers`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `name` | text | 名称 |
| `contact` | text |  |
| `phone` | text |  |
| `notes` | text |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `email` | text |  |
| `tax_no` | text |  |
| `credit_days` | integer |  |
| `on_hold` | boolean |  |

### `pm_products`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | text |  |
| `tenant_id` | bigint | 租户 ID |
| `name` | text | 名称 |
| `start_date` | date |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `pm_tasks`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | text |  |
| `tenant_id` | bigint | 租户 ID |
| `product_id` | text |  |
| `title` | text | 标题 |
| `phase` | text |  |
| `owner` | text |  |
| `notes` | text |  |
| `start_date` | date |  |
| `end_date` | date |  |
| `baseline_start` | date |  |
| `baseline_end` | date |  |
| `history` | jsonb |  |
| `status` | text | 状态 |
| `seq` | integer |  |
| `depends_on` | text |  |

## 🛰 Noon 平台

### `noon_orders` — Noon 订单(92 天滚动窗, 状态标注 cancelled/cir/undeliverable)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `brand` | text | 品牌 |
| `order_nr` | text |  |
| `item_nr` | text |  |
| `sku` | text | 卖家 SKU |
| `country` | text | 国家/站点 |
| `order_placed_at` | timestamp with time zone |  |
| `item_status` | text |  |

### `noon_monthly`

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `mon` | text | 月(YYYY-MM) |
| `currency` | character varying | 币种(ISO) |
| `orders` | integer | 订单数 |
| `items` | integer |  |
| `gross` | numeric |  |
| `updates` | numeric |  |
| `fees` | numeric |  |
| `payouts` | numeric |  |

### `noon_sku_pl`

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `country` | text | 国家/站点 |
| `orders` | integer | 订单数 |
| `gmv` | numeric |  |
| `commission` | numeric |  |
| `delivery_fee` | numeric |  |
| `shipping_credits` | numeric |  |
| `other_order_fees` | numeric |  |
| `order_subsidies` | numeric |  |
| `non_order_fees` | numeric |  |
| `non_order_subsidies` | numeric |  |
| `others` | numeric |  |
| `settlement` | numeric |  |
| `ad_cost` | numeric |  |

### `noon_sku_pl_monthly` — Noon SKU 月度损益(17 列含退款/取消/不可售拆分)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `country` | text | 国家/站点 |
| `mon` | text | 月(YYYY-MM) |
| `orders` | integer | 订单数 |
| `gmv` | numeric | GMV |
| `commission` | numeric | 佣金 |
| `delivery_fee` | numeric | 尾程费 |
| `shipping_credits` | numeric | 运费抵扣 |
| `other_order_fees` | numeric |  |
| `order_subsidies` | numeric |  |
| `non_order_fees` | numeric |  |
| `non_order_subsidies` | numeric |  |
| `others` | numeric |  |
| `settlement` | numeric | 结算净额 |
| `ad_cost` | numeric | 广告费 |
| `refund` | numeric | 退款 |
| `cancelled` | integer | 取消件数 |
| `undeliverable` | integer | 无法配送件数 |
| `valid_units` | integer | 有效件数 |
| `unsaleable` | integer | 不可售 |

### `noon_sku_status`

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `country` | text | 国家/站点 |
| `mon` | text | 月(YYYY-MM) |
| `units` | integer | 件数 |
| `cancelled` | integer |  |
| `undeliverable` | integer |  |
| `cir` | integer |  |

### `noon_sku_ads`

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `country` | text | 国家/站点 |
| `mon` | text | 月(YYYY-MM) |
| `views` | bigint |  |
| `clicks` | bigint | 点击 |
| `orders` | integer | 订单数 |
| `atc` | integer |  |
| `spends` | numeric |  |
| `revenue` | numeric | 营收 |

### `noon_sku_unsaleable`

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `country` | text | 国家/站点 |
| `mon` | text | 月(YYYY-MM) |
| `qty` | integer | 数量 |

### `noon_ads_daily`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `brand` | text | 品牌 |
| `report_date` | date |  |
| `country` | text | 国家/站点 |
| `ad_type` | text |  |
| `campaign_name` | text |  |
| `sku` | text | 卖家 SKU |
| `views` | integer |  |
| `clicks` | integer | 点击 |
| `orders` | integer | 订单数 |
| `atc` | integer |  |
| `spends` | numeric |  |
| `revenue` | numeric | 营收 |

### `noon_inventory`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `brand` | text | 品牌 |
| `partner_sku` | text |  |
| `sku` | text | 卖家 SKU |
| `country` | text | 国家/站点 |
| `sellable` | integer |  |
| `unsellable` | integer |  |
| `total` | integer |  |
| `q_0_30d` | integer |  |
| `q_31_60d` | integer |  |
| `q_61_90d` | integer |  |
| `q_91_180d` | integer |  |
| `q_181_365d` | integer |  |
| `q_366d` | integer |  |
| `snapshot_date` | date |  |

### `noon_statement` — Noon 官方对账单(月×市场)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `market` | text | 市场 |
| `stmt_month` | text |  |
| `opening_balance` | numeric |  |
| `net_proceeds` | numeric |  |
| `total_fees` | numeric |  |
| `payouts` | numeric |  |
| `closing_balance` | numeric |  |
| `bank_transfer` | numeric |  |
| `advertising_fee` | numeric |  |
| `referral_fee` | numeric |  |
| `fbn_outbound_fee` | numeric |  |
| `return_refund` | numeric |  |

### `noon_procurement_cost`

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `product_name` | text |  |
| `cost_rmb` | numeric | 采购成本(RMB) |
| `cost_sar` | numeric |  |
| `cost_aed` | numeric |  |

## 🔍 选品与竞品

### `sourcing_candidates` — 选品候选池

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `level` | text |  |
| `country` | text | 国家/站点 |
| `key` | text |  |
| `sources` | ARRAY |  |
| `first_seen` | date |  |
| `last_seen` | date |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `sourcing_verdicts` — 选品裁决记录

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `candidate_id` | bigint |  |
| `state` | text | 状态 |
| `owner_uid` | bigint |  |
| `score` | numeric |  |
| `gate_flags` | jsonb |  |
| `machine_rec` | text |  |
| `kill_reason` | text |  |
| `note` | text | 说明 |
| `decided_at` | timestamp with time zone |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `sourcing_verdicts_legacy`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `search_term` | text |  |
| `country` | text | 国家/站点 |
| `verdict` | text |  |
| `score` | numeric |  |
| `price` | numeric |  |
| `monthly_sold` | integer |  |
| `bsr` | integer |  |
| `reviews` | integer |  |
| `kill_reason` | text |  |
| `notes` | text |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `tenant_id` | bigint | 租户 ID |

### `sourcing_decision_audit`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `candidate_id` | bigint |  |
| `from_state` | text |  |
| `to_state` | text |  |
| `actor` | bigint |  |
| `note` | text | 说明 |
| `evidence` | jsonb |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `aba_search_terms` — ABA 搜索词(频级/排名)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `marketplace` | text | 市场/站点名 |
| `country` | text | 国家/站点 |
| `period` | text |  |
| `search_term` | text |  |
| `search_frequency_rank` | integer |  |
| `asin_1` | text |  |
| `asin_1_click_share` | numeric |  |
| `asin_1_conv_share` | numeric |  |
| `asin_2` | text |  |
| `asin_2_click_share` | numeric |  |
| `asin_2_conv_share` | numeric |  |
| `asin_3` | text |  |
| `asin_3_click_share` | numeric |  |
| `asin_3_conv_share` | numeric |  |
| `fetched_at` | timestamp with time zone |  |

### `aba_term_universe`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `source` | text |  |
| `country` | text | 国家/站点 |
| `marketplace` | text | 市场/站点名 |
| `search_term` | text |  |

### `aba_meta`

| 列 | 类型 | 含义 |
|---|---|---|
| `tenant_id` | bigint | 租户 ID |
| `key` | text |  |
| `value` | text |  |

### `aba_country_catalog`

| 列 | 类型 | 含义 |
|---|---|---|
| `tenant_id` | bigint | 租户 ID |
| `country` | text | 国家/站点 |
| `first_period` | text |  |
| `last_period` | text |  |
| `available_periods` | integer |  |
| `cached_at` | timestamp with time zone |  |
| `checkpoint_ts` | timestamp with time zone |  |

### `aba_radar_basket`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `country` | text | 国家/站点 |
| `period` | text |  |
| `asin` | text | Amazon ASIN |
| `cp1_asin` | text |  |
| `cp1_pct` | numeric |  |
| `cp2_asin` | text |  |
| `cp2_pct` | numeric |  |
| `cp3_asin` | text |  |
| `cp3_pct` | numeric |  |
| `fetched_at` | timestamp with time zone |  |

### `aba_radar_fragmented`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `country` | text | 国家/站点 |
| `period` | text |  |
| `search_term` | text |  |
| `search_frequency_rank` | integer |  |
| `top1_asin` | text |  |
| `top1_click_share` | numeric |  |
| `top1_conv_share` | numeric |  |
| `top2_asin` | text |  |
| `top2_click_share` | numeric |  |
| `top3_asin` | text |  |
| `top3_click_share` | numeric |  |
| `fragmentation_score` | numeric |  |
| `computed_at` | timestamp with time zone |  |

### `aba_radar_gem`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `country` | text | 国家/站点 |
| `period` | text |  |
| `search_term` | text |  |
| `search_frequency_rank` | integer |  |
| `asin` | text | Amazon ASIN |
| `click_share` | numeric |  |
| `conv_share` | numeric |  |
| `conv_click_ratio` | numeric |  |
| `score` | numeric |  |
| `computed_at` | timestamp with time zone |  |

### `aba_radar_repeat`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `country` | text | 国家/站点 |
| `period` | text |  |
| `asin` | text | Amazon ASIN |
| `orders_total` | integer |  |
| `repeat_orders` | integer |  |
| `repeat_rate` | numeric |  |
| `fetched_at` | timestamp with time zone |  |

### `aba_radar_rising`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `country` | text | 国家/站点 |
| `period` | text |  |
| `prev_period` | text |  |
| `search_term` | text |  |
| `current_rank` | integer |  |
| `prev_rank` | integer |  |
| `rank_change` | integer |  |
| `rank_change_pct` | numeric |  |
| `top1_asin` | text |  |
| `top1_click_share` | numeric |  |
| `top1_conv_share` | numeric |  |
| `top2_asin` | text |  |
| `top2_click_share` | numeric |  |
| `top3_asin` | text |  |
| `top3_click_share` | numeric |  |
| `score` | numeric |  |
| `computed_at` | timestamp with time zone |  |

### `aba_keepa_full`

| 列 | 类型 | 含义 |
|---|---|---|
| `tenant_id` | bigint | 租户 ID |
| `asin` | text | Amazon ASIN |
| `domain_id` | integer |  |
| `parent_asin` | text |  |
| `title` | text | 标题 |
| `brand` | text | 品牌 |
| `manufacturer` | text |  |
| `model` | text |  |
| `root_category` | bigint |  |
| `sales_rank_reference` | bigint |  |
| `sales_rank_display_group` | text |  |
| `bsr_current` | integer |  |
| `bsr_avg90` | integer |  |
| `sales_rank_drops_30` | integer |  |
| `sales_rank_drops_90` | integer |  |
| `sales_rank_drops_180` | integer |  |
| `sales_rank_drops_365` | integer |  |
| `monthly_sold` | integer |  |
| `color` | text |  |
| `size` | text |  |
| `item_weight` | integer |  |
| `package_weight` | integer |  |
| `price_amazon_current` | numeric |  |
| `price_new_current` | numeric |  |
| `price_used_current` | numeric |  |
| `list_price_current` | numeric |  |
| `buy_box_price` | numeric |  |
| `buy_box_is_amazon` | boolean |  |
| `buy_box_is_fba` | boolean |  |
| `count_new_current` | integer |  |
| `offer_count_fba` | integer |  |
| `offer_count_fbm` | integer |  |
| `total_offer_count` | integer |  |
| `out_of_stock_count_amazon_30` | integer |  |
| `out_of_stock_count_amazon_90` | integer |  |
| `rating_current` | numeric |  |
| `reviews_current` | integer |  |
| `reviews_avg90` | integer |  |
| `fba_pick_pack_fee` | numeric |  |
| `referral_fee_percentage` | numeric |  |
| `fetched_at` | timestamp with time zone |  |
| `raw_fetched_at` | timestamp with time zone |  |

### `rankings_daily` — 排名快照(评分/评论数/BSR; Amazon+Noon 双平台, 120 天窗)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `platform` | text | 平台(amazon/noon) |
| `snap_date` | date |  |
| `name` | text | 名称 |
| `asin` | text | Amazon ASIN |
| `market` | text | 市场 |
| `rating` | numeric | 评分(1-5) |
| `review_count` | integer | 评论数 |
| `seller_rating` | numeric |  |
| `bsr_big` | integer |  |
| `bsr_big_category` | text |  |
| `bsr_small` | integer |  |
| `bsr_small_category` | text |  |
| `star_pct` | ARRAY |  |

### `keepa_daily` — Keepa 关注池日快照(buybox 价格/销量排名/卖家数)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `domain` | smallint |  |
| `asin` | text | Amazon ASIN |
| `snap_date` | date |  |
| `buybox_price` | numeric |  |
| `price_new` | numeric |  |
| `currency` | character | 币种(ISO) |
| `salesrank` | integer |  |
| `drops30` | integer |  |
| `drops90` | integer |  |
| `offer_count_new` | integer |  |
| `offer_count_fba` | integer |  |
| `rating` | numeric | 评分(1-5) |
| `review_count` | integer | 评论数 |
| `hist` | jsonb |  |
| `pulled_at` | timestamp with time zone |  |

### `keepa_watch`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `domain` | smallint |  |
| `asin` | text | Amazon ASIN |
| `title` | text | 标题 |
| `img_url` | text |  |
| `source` | text |  |
| `keyword` | text |  |
| `created_by` | bigint |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `keepa_pull_log`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `pull_at` | timestamp with time zone |  |
| `endpoint` | text |  |
| `asin_count` | integer |  |
| `tokens_used` | integer |  |
| `tenant_id` | bigint | 租户 ID |
| `note` | text | 说明 |

## 📝 Listing 与内容

### `sku_mapping` — SKU 映射核心表(品牌×SKU↔ASIN/NSKU/成本; 映射为核心铁律落点)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `product_name` | text |  |
| `model_name` | text | 型号 |
| `model_number` | text | 型号编号 |
| `color` | text | 颜色 |
| `size` | text | 尺码 |
| `platform` | text | 平台(amazon/noon) |
| `country` | text | 国家/站点 |
| `sku` | text | 卖家 SKU |
| `nsku` | text | Noon SKU |
| `asin` | text | Amazon ASIN |
| `cost_rmb` | numeric | 采购成本(RMB) |
| `campaign_pattern` | text | 广告活动匹配模式 |
| `upc` | text | UPC 码 |

### `listing_tasks` — Listing 上架任务(状态机: 建任务→规格书→生成→审核→批准→上传)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `product_id` | bigint |  |
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `platform` | text | 平台(amazon/noon) |
| `market` | text | 市场 |
| `category` | text |  |
| `keywords` | text |  |
| `status` | text | 状态 |
| `title` | text | 标题 |
| `bullets` | jsonb |  |
| `description` | text |  |
| `attrs` | jsonb |  |
| `spec_id` | bigint |  |
| `gen_meta` | jsonb |  |
| `version` | integer |  |
| `created_by` | bigint |  |
| `approved_by` | bigint |  |
| `approved_at` | timestamp with time zone |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |
| `product_type` | text |  |
| `asin` | text | Amazon ASIN |
| `submit_result` | jsonb |  |

### `listing_events`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `task_id` | bigint |  |
| `actor` | bigint |  |
| `action` | text |  |
| `detail` | jsonb |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `listing_specs`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `product_id` | bigint |  |
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `filename` | text |  |
| `file_type` | text |  |
| `raw_text` | text |  |
| `parsed_kv` | jsonb |  |
| `uploaded_by` | bigint |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `listing_templates`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `category` | text |  |
| `platform` | text | 平台(amazon/noon) |
| `kind` | text |  |
| `pattern` | text |  |
| `priority` | integer |  |
| `active` | boolean |  |
| `version` | integer |  |
| `updated_by` | bigint |  |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

### `listing_category_meta`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | integer |  |
| `brand` | text | 品牌 |
| `market` | text | 市场 |
| `product_type` | text |  |
| `display_name` | text |  |
| `schema_raw` | jsonb |  |
| `attr_count` | integer |  |
| `fetched_at` | timestamp with time zone |  |

### `listing_pt_suggest`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | integer |  |
| `brand` | text | 品牌 |
| `sku` | text | 卖家 SKU |
| `market` | text | 市场 |
| `product_type` | text |  |
| `display_name` | text |  |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

### `aplus_docs`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `name` | text | 名称 |
| `asins` | jsonb |  |
| `market` | text | 市场 |
| `template` | text |  |
| `content` | jsonb |  |
| `status` | text | 状态 |
| `doc_key` | text |  |
| `created_by` | bigint |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

### `aplus_history`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `action` | text |  |
| `asin` | text | Amazon ASIN |
| `market` | text | 市场 |
| `status` | text | 状态 |
| `ok` | boolean |  |
| `detail` | text |  |
| `at` | timestamp with time zone |  |

### `aplus_media`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `media_ref` | text |  |
| `lang` | text |  |
| `tag` | text |  |
| `created_by` | bigint |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `product_reviews` — 评论 VOC 原文表(2026-09-24 建; 数据源攻坚遇登录墙已搁置, 零行)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `brand` | text | 品牌 |
| `asin` | text | Amazon ASIN |
| `country` | text | 国家/站点 |
| `rating` | numeric | 评分(1-5) |
| `title` | text | 标题 |
| `body` | text |  |
| `review_date` | date |  |
| `verified` | boolean |  |
| `helpful_votes` | integer | 有用票数 |
| `reviewer` | text |  |
| `fetched_at` | timestamp with time zone |  |

## 🚚 物流

### `logistics_shipments` — 物流运单(在途轨迹, 7 天无更新报警)

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `awb` | character varying |  |
| `from_country` | text |  |
| `to_country` | text |  |
| `city` | text |  |
| `weight` | numeric |  |
| `ship_date` | date |  |
| `type` | text |  |
| `remark` | text |  |
| `products_text` | text |  |
| `badge` | text |  |
| `badge_label` | text |  |
| `latest_event` | text |  |
| `latest_event_time` | text |  |
| `stage_overdue` | boolean |  |
| `traces` | jsonb |  |
| `product_name` | text |  |
| `model_number` | text |  |

### `logistics_stats`

| 列 | 类型 | 含义 |
|---|---|---|
| `brand` | text | 品牌 |
| `total` | integer |  |
| `transit` | integer |  |
| `delivered` | integer |  |
| `exception` | integer |  |
| `customs` | integer |  |
| `awaiting` | integer |  |
| `stage_overdue` | integer |  |
| `as_of` | date |  |

### `logistics_params`

| 列 | 类型 | 含义 |
|---|---|---|
| `tenant_id` | integer | 租户 ID |
| `params` | jsonb |  |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

## 📢 推广渠道

### `promotion_channels` — 推广渠道目录(红人/测评站; 采集自 mercury)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `name` | text | 名称 |
| `type` | text |  |
| `tier` | text |  |
| `country` | text | 国家/站点 |
| `platform` | text | 平台(amazon/noon) |
| `language` | text |  |
| `cost` | text |  |
| `contact` | text |  |
| `submit_method` | text |  |
| `est_orders` | text |  |
| `status` | text | 状态 |
| `notes` | text |  |
| `follower_count` | bigint |  |
| `activity_score` | numeric |  |
| `last_checked` | timestamp without time zone |  |
| `fit_keyboard` | integer |  |
| `fit_earphone` | integer |  |
| `fit_security` | integer |  |
| `fit_bra` | integer |  |
| `fit_brainews` | integer |  |
| `source_url` | text |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

### `promotion_kol_channels`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | integer |  |
| `tenant_id` | bigint | 租户 ID |
| `platform` | text | 平台(amazon/noon) |
| `channel_name` | text |  |
| `channel_id` | text |  |
| `subscriber_count` | integer |  |
| `max_video_views` | integer |  |
| `video_count` | integer |  |
| `countries` | ARRAY |  |
| `categories` | ARRAY |  |
| `language` | text |  |
| `activity_score` | numeric |  |
| `avg_views` | bigint |  |
| `avg_likes` | bigint |  |
| `avg_comments` | bigint |  |
| `engagement_rate` | numeric |  |
| `contact_email` | text |  |
| `contact_url` | text |  |
| `source_url` | text |  |

### `promotion_kol_high`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | integer |  |
| `tenant_id` | bigint | 租户 ID |
| `platform` | text | 平台(amazon/noon) |
| `channel_name` | text |  |
| `channel_id` | text |  |
| `main_category` | text |  |
| `all_categories` | ARRAY |  |
| `outreach_status` | text |  |
| `contact_email` | text |  |
| `notes` | text |  |

### `promotion_orders`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `product` | text |  |
| `channel` | text |  |
| `amount` | numeric |  |
| `currency` | text | 币种(ISO) |
| `status` | text | 状态 |
| `requested_by` | text |  |
| `approved_by` | text |  |
| `requested_at` | timestamp with time zone |  |
| `approved_at` | timestamp with time zone |  |
| `note` | text | 说明 |

### `promotion_products`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `name` | text | 名称 |
| `channel` | text |  |
| `asin` | text | Amazon ASIN |
| `price` | text |  |
| `rating` | text | 评分(1-5) |
| `reviews` | text |  |
| `stock` | text |  |
| `coupon_ready` | text |  |
| `margin` | text |  |
| `selling_point` | text |  |
| `info_complete` | integer |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

### `promotion_review_sites`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | integer |  |
| `tenant_id` | bigint | 租户 ID |
| `domain` | text |  |
| `site_name` | text |  |
| `category` | text |  |
| `priority` | integer |  |
| `emails` | text |  |
| `contact_page` | text |  |
| `notes` | text |  |
| `outreach_status` | text |  |

### `promotion_submissions`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `product` | text |  |
| `channel` | text |  |
| `submitted_by` | text |  |
| `result` | text |  |
| `orders` | integer | 订单数 |
| `note` | text | 说明 |
| `submitted_at` | timestamp with time zone |  |

### `promotion_tasks`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `product_key` | text |  |
| `action` | text |  |
| `status` | text | 状态 |
| `note` | text | 说明 |
| `assigned_to` | text |  |
| `is_pinned` | boolean |  |
| `created_by` | bigint |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

### `promotion_crawl_stats`

| 列 | 类型 | 含义 |
|---|---|---|
| `hour` | timestamp with time zone |  |
| `region` | text |  |
| `discovered` | integer |  |
| `inserted` | integer |  |
| `enriched` | integer |  |
| `failed` | integer |  |
| `contacts` | integer |  |

### `brand_channels`

| 列 | 类型 | 含义 |
|---|---|---|
| `tenant_id` | bigint | 租户 ID |
| `brand` | text | 品牌 |
| `platform` | text | 平台(amazon/noon) |
| `marketplace` | text | 市场/站点名 |
| `account` | text |  |
| `mode` | text |  |
| `note` | text | 说明 |
| `enabled` | boolean | 启用开关 |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

## 🗂 基础注册表

### `brands_source` — 品牌×平台管道注册表(唯一事实源: marketplaces/source_map 显式键)

| 列 | 类型 | 含义 |
|---|---|---|
| `tenant_id` | bigint | 租户 ID |
| `brand` | text | 品牌 |
| `platform` | text | 平台(amazon/noon) |
| `marketplaces` | ARRAY | 站点清单(text[]; 断流检测基准, UK 口径) |
| `collector` | text | 采集归属(mercury/venus) |
| `source_schema` | text | mercury 源 schema(同构域命名规律根) |
| `enabled` | boolean | 启用开关 |
| `note` | text | 说明 |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `source_map` | json | 源表映射(jsonb; 显式键 finances_view/statement_official) |

### `marketplaces` — 站点注册表(country→currency→marketplace_id, 广告折算基准)

| 列 | 类型 | 含义 |
|---|---|---|
| `platform` | text | 平台(amazon/noon) |
| `country` | text | 国家/站点 |
| `marketplace_domain` | text |  |
| `currency` | text | 币种(ISO) |
| `marketplace_id` | text |  |

### `platforms`

| 列 | 类型 | 含义 |
|---|---|---|
| `platform` | text | 平台(amazon/noon) |
| `name` | text | 名称 |
| `ads_model` | text |  |
| `status` | text | 状态 |
| `sort` | integer |  |

### `pipe_domains` — 平台×域断更矩阵(断更报警的注册表化)

| 列 | 类型 | 含义 |
|---|---|---|
| `platform` | text | 平台(amazon/noon) |
| `domain` | text |  |
| `table_name` | text |  |
| `date_col` | text |  |
| `stale_days` | numeric |  |
| `brand_override` | json |  |
| `note` | text | 说明 |

### `fx_rates` — 汇率日表(11 币种; 全站本土货币框架基准)

| 列 | 类型 | 含义 |
|---|---|---|
| `cur` | text |  |
| `rate_date` | date |  |
| `usd_rate` | numeric |  |
| `source` | text |  |

### `credentials`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `kind` | text |  |
| `label` | text |  |
| `ciphertext` | bytea |  |
| `key_id` | text |  |
| `rotated_at` | timestamp with time zone |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `tenant_credentials`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | integer |  |
| `tenant_id` | integer | 租户 ID |
| `category` | text |  |
| `provider` | text |  |
| `name` | text | 名称 |
| `config_enc` | bytea |  |
| `key_preview` | text |  |
| `status` | text | 状态 |
| `status_msg` | text |  |
| `last_verified_at` | timestamp with time zone |  |
| `created_by` | integer |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

## ⚙️ 运营与计费

### `audit_results` — 四层审计结果(只追加+禁改删触发器)

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `batch_id` | text |  |
| `layer` | text |  |
| `check_key` | text |  |
| `status` | text | 状态 |
| `detail` | text |  |
| `checked_at` | timestamp with time zone |  |

### `audit_known_issues` — 审计挂账白名单(expires_at 过期自动复报)

| 列 | 类型 | 含义 |
|---|---|---|
| `check_key` | text |  |
| `reason` | text |  |
| `expires_at` | date |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `audit_thresholds` — 审计阈值注册表(21 项, 调阈值不发版)

| 列 | 类型 | 含义 |
|---|---|---|
| `check_key` | text |  |
| `value` | numeric |  |
| `note` | text | 说明 |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

### `audit_baselines` — 数据质量基线(invalid 率相对阈值)

| 列 | 类型 | 含义 |
|---|---|---|
| `check_key` | text |  |
| `metric` | text |  |
| `value` | numeric |  |
| `note` | text | 说明 |

### `api_fields_catalog`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `group_key` | text |  |
| `sub` | text |  |
| `schema_name` | text |  |
| `table_name` | text |  |
| `rows_cnt` | bigint |  |
| `desc_text` | text |  |
| `columns` | jsonb |  |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

### `subscriptions`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `plan` | text |  |
| `seats` | integer |  |
| `period_start` | timestamp with time zone |  |
| `period_end` | timestamp with time zone |  |
| `status` | text | 状态 |

### `billing_events`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `tenant_id` | bigint | 租户 ID |
| `event_type` | text |  |
| `plan_from` | text |  |
| `plan_to` | text |  |
| `stripe_session_id` | text |  |
| `stripe_customer_id` | text |  |
| `amount_cents` | integer |  |
| `currency` | text | 币种(ISO) |
| `raw` | jsonb |  |

### `usage_daily`

| 列 | 类型 | 含义 |
|---|---|---|
| `tenant_id` | bigint | 租户 ID |
| `day` | date | 日(口径随表: 订单系=北京时间, 广告系=Amazon 站点日) |
| `api_calls` | bigint |  |
| `rows_ingested` | bigint |  |
| `storage_mb` | numeric |  |
| `ai_calls` | bigint |  |

### `provisioning_log`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `actor_uid` | bigint |  |
| `action` | text |  |
| `detail` | jsonb |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `audit_log`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `user_id` | bigint |  |
| `action` | text |  |
| `resource` | text |  |
| `ip` | inet |  |
| `trace_id` | text |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

## 👤 租户与账号(系统)

### `tenants`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `slug` | text |  |
| `name` | text | 名称 |
| `plan` | text |  |
| `status` | text | 状态 |
| `schema_prefix` | text |  |
| `max_users` | integer |  |
| `settings` | jsonb |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `suspended_at` | timestamp with time zone |  |

### `tenant_brands`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `brand` | text | 品牌 |
| `is_active` | boolean |  |

### `tenant_modules`

| 列 | 类型 | 含义 |
|---|---|---|
| `tenant_id` | bigint | 租户 ID |
| `module_key` | text |  |
| `enabled` | boolean | 启用开关 |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |

### `tenant_credential_events`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | integer | 租户 ID |
| `credential_id` | integer |  |
| `actor` | integer |  |
| `action` | text |  |
| `detail` | jsonb |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `users`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `email` | text |  |
| `password_scrypt` | text |  |
| `role` | text |  |
| `status` | text | 状态 |
| `mfa_secret` | text |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |
| `last_login_at` | timestamp with time zone |  |
| `name` | text | 名称 |
| `job_label` | text |  |

### `user_brands`

| 列 | 类型 | 含义 |
|---|---|---|
| `tenant_id` | bigint | 租户 ID |
| `user_id` | bigint |  |
| `brand` | text | 品牌 |

### `user_modules`

| 列 | 类型 | 含义 |
|---|---|---|
| `tenant_id` | bigint | 租户 ID |
| `user_id` | bigint |  |
| `module_key` | text |  |
| `granted` | boolean |  |

### `user_dashboard_prefs`

| 列 | 类型 | 含义 |
|---|---|---|
| `tenant_id` | bigint | 租户 ID |
| `user_id` | bigint |  |
| `kpi_cards` | jsonb |  |
| `updated_at` | timestamp with time zone | 更新时间(UTC) |
| `layouts` | jsonb |  |

### `upload_files`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `filename` | text |  |
| `stored_path` | text |  |
| `url_path` | text |  |
| `size_bytes` | bigint |  |
| `content_type` | text |  |
| `uploaded_by` | bigint |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

### `documents_nodes`

| 列 | 类型 | 含义 |
|---|---|---|
| `id` | bigint |  |
| `tenant_id` | bigint | 租户 ID |
| `path` | text |  |
| `name` | text | 名称 |
| `parent` | text |  |
| `type` | text |  |
| `url` | text |  |
| `created_at` | timestamp with time zone | 创建时间(UTC) |

## 🧾 其他表(未分域)

- `mcp_keys` (4 行, 8 列)
- `term_field_map` (63 行, 4 列)

---
附: mercury 源库字段目录见 SaaS 库 `api_fields_catalog` 表(181 表快照); 数据链路全景见 [data-lineage-2026-09-18](/audit/data-lineage-2026-09-18.html)。
