-- Migration: Add tenant_id column to users table
-- Date: 2026-01-26
-- Description: Add multi-tenancy support to users table

-- Add tenant_id column
ALTER TABLE users
ADD COLUMN IF NOT EXISTS tenant_id uuid;

-- Create indexes for multi-tenant queries
CREATE INDEX IF NOT EXISTS idx_users_tenant ON users(tenant_id);
CREATE INDEX IF NOT EXISTS idx_users_tenant_phone ON users(tenant_id, phone);
CREATE INDEX IF NOT EXISTS idx_users_tenant_fingerprint ON users(tenant_id, fingerprint);

-- Add comment
COMMENT ON COLUMN users.tenant_id IS 'Tenant ID for multi-tenancy support';
