Files
flatrender/backend/db/migrations/20_identity_user_crm.sql
T

16 lines
695 B
SQL
Raw Normal View History

-- =====================================================================
-- IDENTITY SCHEMA — Part 20: CRM notes/tags per customer
-- Lightweight CRM overlay on identity.users (tags, free-form note, pipeline status).
-- Acquisition/conversion analytics are computed live from users + payments.
-- =====================================================================
SET search_path TO identity, public;
CREATE TABLE IF NOT EXISTS user_crm (
user_id UUID PRIMARY KEY,
tags TEXT[] NOT NULL DEFAULT '{}',
note TEXT,
status TEXT NOT NULL DEFAULT 'new', -- new | contacted | customer | churned
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);