fixed register
This commit is contained in:
@@ -3,8 +3,21 @@
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `customers`
|
||||
ADD COLUMN `total_referrals` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `referral_to_id`;
|
||||
SET @db = DATABASE();
|
||||
SET @sql = IF(
|
||||
(SELECT COUNT(*) FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'customers' AND COLUMN_NAME = 'total_referrals') = 0,
|
||||
IF(
|
||||
(SELECT COUNT(*) FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'customers' AND COLUMN_NAME = 'referral_to_id') > 0,
|
||||
'ALTER TABLE `customers` ADD COLUMN `total_referrals` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `referral_to_id`',
|
||||
'ALTER TABLE `customers` ADD COLUMN `total_referrals` INT UNSIGNED NOT NULL DEFAULT 0'
|
||||
),
|
||||
'SELECT ''skip customers.total_referrals'' AS info'
|
||||
);
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- همتراز با تعداد ثبتنامهای واقعی (اختیاری ولی توصیه میشود)
|
||||
UPDATE `customers` AS c
|
||||
|
||||
Reference in New Issue
Block a user