Files
pwap/web/supabase/migrations/002_add_profile_columns.sql
T
Claude 24be8d4411 Reorganize repository into monorepo structure
Restructured the project to support multiple frontend applications:
- Move web app to web/ directory
- Create pezkuwi-sdk-ui/ for Polkadot SDK clone (planned)
- Create mobile/ directory for mobile app development
- Add shared/ directory with common utilities, types, and blockchain code
- Update README.md with comprehensive documentation
- Remove obsolete DKSweb/ directory

This monorepo structure enables better code sharing and organized
development across web, mobile, and SDK UI projects.
2025-11-14 00:46:35 +00:00

80 lines
2.4 KiB
SQL

-- ========================================
-- Add Missing Columns to Profiles Table
-- ========================================
-- Run this in Supabase SQL Editor
-- Dashboard → SQL Editor → New Query → Paste & Run
-- Add bio column
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS bio TEXT;
-- Add phone column
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS phone TEXT;
-- Add language column (default: 'en')
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS language TEXT DEFAULT 'en';
-- Add theme column (default: 'dark')
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS theme TEXT DEFAULT 'dark';
-- Add notification preferences
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS notifications_email BOOLEAN DEFAULT true;
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS notifications_push BOOLEAN DEFAULT false;
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS notifications_sms BOOLEAN DEFAULT false;
-- Add 2FA column
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS two_factor_enabled BOOLEAN DEFAULT false;
-- Add location and website columns (for completeness)
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS location TEXT;
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS website TEXT;
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS phone_number TEXT;
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS recovery_email TEXT;
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS recovery_email_verified BOOLEAN DEFAULT false;
-- Add email_verified (for compatibility, though we prefer user.email_confirmed_at)
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS email_verified BOOLEAN DEFAULT false;
-- Add joined_at column
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS joined_at TIMESTAMP WITH TIME ZONE DEFAULT TIMEZONE('utc'::text, NOW());
-- Add role column
ALTER TABLE public.profiles
ADD COLUMN IF NOT EXISTS role TEXT DEFAULT 'Member';
-- Create indexes for frequently queried columns
CREATE INDEX IF NOT EXISTS idx_profiles_phone ON public.profiles(phone);
CREATE INDEX IF NOT EXISTS idx_profiles_language ON public.profiles(language);
CREATE INDEX IF NOT EXISTS idx_profiles_location ON public.profiles(location);
-- Update existing users' joined_at to their created_at if null
UPDATE public.profiles
SET joined_at = created_at
WHERE joined_at IS NULL;
-- Success message
DO $$
BEGIN
RAISE NOTICE 'Profile columns added successfully!';
END $$;