Keyan c6554d3ca7
Referral Rewards (#1262)
* referral rewards

* make referral notifications consistent

* remove plpgsql from earn job

* remove dead code

* remove debug logging
2024-07-10 19:23:05 -05:00

32 lines
1.3 KiB
SQL

ALTER TYPE "EarnType" ADD VALUE 'FOREVER_REFERRAL';
ALTER TYPE "EarnType" ADD VALUE 'ONE_DAY_REFERRAL';
-- delete attributing one day referrals to pages
DELETE FROM "OneDayReferral"
WHERE "typeId" IN (
SELECT id::text
FROM users
WHERE name IN (
'api', 'auth', 'day', 'invites', 'invoices', 'referrals', 'rewards',
'satistics', 'settings', 'stackers', 'wallet', 'withdrawals', '404', '500',
'email', 'live', 'login', 'notifications', 'offline', 'search', 'share',
'signup', 'territory', 'recent', 'top', 'edit', 'post', 'rss', 'saloon',
'faq', 'story', 'privacy', 'copyright', 'tos', 'changes', 'guide', 'daily',
'anon', 'ad'
)
);
-- delete attributing forever referrals to pages
UPDATE users SET "referrerId" = NULL
WHERE "referrerId" IN (
SELECT id
FROM users
WHERE name IN (
'api', 'auth', 'day', 'invites', 'invoices', 'referrals', 'rewards',
'satistics', 'settings', 'stackers', 'wallet', 'withdrawals', '404', '500',
'email', 'live', 'login', 'notifications', 'offline', 'search', 'share',
'signup', 'territory', 'recent', 'top', 'edit', 'post', 'rss', 'saloon',
'faq', 'story', 'privacy', 'copyright', 'tos', 'changes', 'guide', 'daily',
'anon', 'ad'
)
);