hi-server/initialize/migrate/database/02140_subscribe_new_user_only.up.sql
shanshanzhong dcfcd036de
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m46s
x
2026-03-08 22:37:58 -07:00

13 lines
617 B
SQL

-- Add new_user_only column to subscribe table
SET @column_exists = (SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'subscribe'
AND COLUMN_NAME = 'new_user_only');
SET @sql = IF(@column_exists = 0,
'ALTER TABLE `subscribe` ADD COLUMN `new_user_only` tinyint(1) DEFAULT 0 COMMENT ''New user only: allow purchase within 24h of registration, once per user'' AFTER `quota`',
'SELECT 1');
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;