hyapp-server/server/admin/migrations/074_legacy_google_paid_details.sql
2026-07-03 17:35:47 +08:00

21 lines
1.7 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.

SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
-- legacy AppYumi/Aslan的谷歌账单实付明细缓存likei 平台 Mongo 对 admin 只读,
-- Play Orders API 同步到的实付币种/总额/税/净收入落在 admin 库,按账单交易号回填财务充值明细。
CREATE TABLE IF NOT EXISTS admin_legacy_google_paid_details (
app_code VARCHAR(32) NOT NULL COMMENT '应用编码yumi/aslan',
transaction_id VARCHAR(96) NOT NULL COMMENT 'legacy 内购明细内部订单 IDin_app_purchase_details._id',
provider_order_id VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'Google 订单号GPA.xxx',
paid_currency_code VARCHAR(8) NOT NULL DEFAULT '' COMMENT '用户实付币种,来自 Google Orders API',
paid_amount_micro BIGINT NOT NULL DEFAULT 0 COMMENT '用户实付总额微单位(实付币种)',
paid_tax_micro BIGINT NOT NULL DEFAULT 0 COMMENT '订单税额微单位(实付币种)',
paid_net_micro BIGINT NOT NULL DEFAULT 0 COMMENT 'Google 扣费后开发者净收入微单位(实付币种)',
bill_usd_minor BIGINT NOT NULL DEFAULT 0 COMMENT '账单美金流水快照(美分),同步时从 legacy 账单带入',
bill_created_at_ms BIGINT NOT NULL DEFAULT 0 COMMENT '账单创建时间快照UTC epoch ms',
synced_at_ms BIGINT NOT NULL COMMENT '实付明细同步时间UTC epoch ms',
created_at_ms BIGINT NOT NULL COMMENT '创建时间UTC epoch ms',
updated_at_ms BIGINT NOT NULL COMMENT '更新时间UTC epoch ms',
PRIMARY KEY (app_code, transaction_id),
KEY idx_legacy_google_paid_bill_time (app_code, bill_created_at_ms)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='legacy App 谷歌账单实付明细缓存';