RBAC, Permissions, and Export/Import

This commit is contained in:
Koncept Kit
2025-12-16 20:03:50 +07:00
parent b268c3fff8
commit ed5526e27b
27 changed files with 10284 additions and 73 deletions

View File

@@ -0,0 +1,23 @@
-- Migration: Add Terms of Service acceptance fields to users table
--
-- This migration adds:
-- - accepts_tos: Boolean field to track ToS acceptance
-- - tos_accepted_at: Timestamp of when user accepted ToS
-- Add accepts_tos column (Boolean, default False)
ALTER TABLE users
ADD COLUMN accepts_tos BOOLEAN DEFAULT FALSE NOT NULL;
-- Add tos_accepted_at column (nullable timestamp)
ALTER TABLE users
ADD COLUMN tos_accepted_at TIMESTAMP WITH TIME ZONE;
-- Backfill existing users: mark as accepted with created_at date
-- This is reasonable since existing users registered before ToS requirement
UPDATE users
SET accepts_tos = TRUE,
tos_accepted_at = created_at
WHERE created_at IS NOT NULL;
-- Success message
SELECT 'Migration completed: ToS acceptance fields added to users table' AS result;