feat(server): add show_on_tv product flag and public /tv products API
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -43,6 +43,31 @@ DEALLOCATE PREPARE stmt;
|
||||
-- یکبار برای اصلاح سرورهایی که قبلاً DEFAULT 1 داشتند:
|
||||
-- UPDATE `products` SET `show_in_assets` = 0;
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- products.show_on_tv (تابلو قیمت /tv)
|
||||
-- ---------------------------------------------------------------------------
|
||||
SET @sql = IF(
|
||||
(SELECT COUNT(*) FROM information_schema.TABLES
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'products') > 0
|
||||
AND (SELECT COUNT(*) FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'products' AND COLUMN_NAME = 'show_on_tv') = 0,
|
||||
IF(
|
||||
(SELECT COUNT(*) FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'products' AND COLUMN_NAME = 'show_in_assets') > 0,
|
||||
'ALTER TABLE `products` ADD COLUMN `show_on_tv` TINYINT(1) NOT NULL DEFAULT 0 COMMENT ''نمایش در تابلو /tv'' AFTER `show_in_assets`',
|
||||
IF(
|
||||
(SELECT COUNT(*) FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'products' AND COLUMN_NAME = 'show') > 0,
|
||||
'ALTER TABLE `products` ADD COLUMN `show_on_tv` TINYINT(1) NOT NULL DEFAULT 0 COMMENT ''نمایش در تابلو /tv'' AFTER `show`',
|
||||
'ALTER TABLE `products` ADD COLUMN `show_on_tv` TINYINT(1) NOT NULL DEFAULT 0 COMMENT ''نمایش در تابلو /tv'''
|
||||
)
|
||||
),
|
||||
'SELECT ''skip products.show_on_tv'' AS info'
|
||||
);
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- products.use_last_price_if_zero (fallback وقتی provider صفر است)
|
||||
-- ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user