hyapp-server/server/admin/migrations/087_legacy_google_paid_sync_attempts.sql

16 lines
1.1 KiB
SQL

SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
-- Google paid-detail failures are not paid facts. Keep retry state in a separate table so the
-- finance list/overview can continue treating admin_legacy_google_paid_details as successful cache only.
CREATE TABLE IF NOT EXISTS admin_legacy_google_paid_sync_attempts (
app_code VARCHAR(32) NOT NULL COMMENT 'legacy App code',
transaction_id VARCHAR(96) NOT NULL COMMENT 'in_app_purchase_details._id',
attempt_count INT NOT NULL DEFAULT 0 COMMENT 'consecutive failed attempts',
last_error VARCHAR(512) NOT NULL DEFAULT '' COMMENT 'last sanitized synchronization error',
next_retry_at_ms BIGINT NOT NULL DEFAULT 0 COMMENT 'next retry time, UTC epoch ms',
created_at_ms BIGINT NOT NULL COMMENT 'created time, UTC epoch ms',
updated_at_ms BIGINT NOT NULL COMMENT 'updated time, UTC epoch ms',
PRIMARY KEY (app_code, transaction_id),
KEY idx_legacy_google_paid_retry (app_code, next_retry_at_ms, updated_at_ms)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='legacy Google paid-detail retry state';