feat: 为订单表添加 IAP 相关字段并调整 IAP 对账逻辑参数。
Build docker and publish / build (20.15.1) (push) Successful in 7m34s

This commit is contained in:
2026-03-10 21:12:39 -07:00
parent 7c2eddf9c3
commit 4095552252
3 changed files with 14 additions and 6 deletions
@@ -1,5 +1,13 @@
-- Add subscription_user_id column to order table
ALTER TABLE `order` ADD COLUMN `subscription_user_id` bigint NOT NULL DEFAULT 0 COMMENT 'Target user ID for subscription (0=same as UserId)' AFTER `user_id`;
-- Add subscription_user_id column to order table (idempotent)
SET @col_exists = (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'order' AND COLUMN_NAME = 'subscription_user_id');
SET @sql = IF(@col_exists = 0, 'ALTER TABLE `order` ADD COLUMN `subscription_user_id` bigint NOT NULL DEFAULT 0 COMMENT ''Target user ID for subscription (0=same as UserId)'' AFTER `user_id`', 'SELECT 1');
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- Add app_account_token column to order table for Apple IAP
ALTER TABLE `order` ADD COLUMN `app_account_token` varchar(36) DEFAULT NULL COMMENT 'Apple IAP App Account Token (UUID)' AFTER `subscribe_token`;
-- Add app_account_token column to order table for Apple IAP (idempotent)
SET @col_exists2 = (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'order' AND COLUMN_NAME = 'app_account_token');
SET @sql2 = IF(@col_exists2 = 0, 'ALTER TABLE `order` ADD COLUMN `app_account_token` varchar(36) DEFAULT NULL COMMENT ''Apple IAP App Account Token (UUID)'' AFTER `subscribe_token`', 'SELECT 1');
PREPARE stmt2 FROM @sql2;
EXECUTE stmt2;
DEALLOCATE PREPARE stmt2;