feat: enhance limits

This commit is contained in:
Krispire Admin
2026-06-23 14:21:45 +05:30
parent eadef33eac
commit 96ebbfd719
12 changed files with 183 additions and 53 deletions
@@ -0,0 +1,15 @@
-- Per-user save-limit overrides, set by admins from the panel. NULL means
-- "use the plan default" (free: 1 bookmark, 5 public + 5 private collections;
-- premium: 5 bookmarks, unlimited collections). A non-NULL value caps that
-- resource for this specific user, regardless of plan.
ALTER TABLE users
ADD COLUMN IF NOT EXISTS bookmark_limit INT,
ADD COLUMN IF NOT EXISTS public_collection_limit INT,
ADD COLUMN IF NOT EXISTS private_collection_limit INT;
ALTER TABLE users
ADD CONSTRAINT users_limit_overrides_nonneg CHECK (
(bookmark_limit IS NULL OR bookmark_limit >= 0) AND
(public_collection_limit IS NULL OR public_collection_limit >= 0) AND
(private_collection_limit IS NULL OR private_collection_limit >= 0)
);