-- Add custom domain support to institutes table
-- Run this SQL on your production database

-- Add custom_domain column if it doesn't exist
ALTER TABLE institutes 
ADD COLUMN IF NOT EXISTS custom_domain VARCHAR(255) NULL DEFAULT NULL AFTER slug;

-- Add domain_verified column to track verification status
ALTER TABLE institutes 
ADD COLUMN IF NOT EXISTS domain_verified TINYINT(1) NOT NULL DEFAULT 0 AFTER custom_domain;

-- Add domain_verification_code for verification process
ALTER TABLE institutes 
ADD COLUMN IF NOT EXISTS domain_verification_code VARCHAR(64) NULL DEFAULT NULL AFTER domain_verified;

-- Add unique index on custom_domain to prevent duplicates
CREATE UNIQUE INDEX idx_custom_domain ON institutes(custom_domain);

-- Example: Set custom domain for an institute
-- UPDATE institutes SET custom_domain = 'pukarphulara.com.np', domain_verified = 1 WHERE slug = 'your-institute-slug';

-- To set custom domain for ashlya-academy institute:
-- UPDATE institutes SET custom_domain = 'pukarphulara.com.np', domain_verified = 1 WHERE slug = 'ashlya-academy';
