Validates Supabase database schema changes for the NABIP AMS, ensuring migrations align with member management, event tracking, chapter hierarchy, and financial models. Use when working with Supabase tables, RLS policies, or database migrations for members, chapters, events, courses, or transactions.
Establish data integrity rules to ensure reliable database operations across the NABIP Association Management System.
Activate this skill when:
Member Tables
members table includes: id, email, member_type, status, chapter_id, joined_dateEvent Management
Financial Tables
Row Level Security (RLS)
-- Example: Member table with proper constraints
CREATE TABLE IF NOT EXISTS members (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email TEXT UNIQUE NOT NULL,
member_type TEXT NOT NULL CHECK (member_type IN ('national', 'state', 'local')),
status TEXT NOT NULL CHECK (status IN ('active', 'pending', 'inactive', 'suspended')),
chapter_id UUID REFERENCES chapters(id),
engagement_score INTEGER DEFAULT 0 CHECK (engagement_score >= 0 AND engagement_score <= 100),
joined_date TIMESTAMPTZ NOT NULL DEFAULT NOW(),
renewal_date TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- Enable RLS
ALTER TABLE members ENABLE ROW LEVEL SECURITY;
-- Example policy for member self-access
CREATE POLICY "Members can view own data"
ON members FOR SELECT
USING (auth.uid() = id);
chapter_id for hierarchy queriesemail for lookupsstatus for filteringmember_type for segmentationcreated_at for temporal queries❌ Avoid: Missing foreign key constraints ✅ Use: Explicit REFERENCES with ON DELETE CASCADE/SET NULL
❌ Avoid: Unrestricted RLS policies ✅ Use: Role-based policies tied to auth.jwt()
❌ Avoid: Missing updated_at triggers ✅ Use: Automatic timestamp updates via triggers
When validating schemas, provide:
member-workflow for data model alignmentrbac-validator for permission checksanalytics-helper for optimized queriesBest for: Developers working on backend data models, database migrations, or multi-tenant access control in the NABIP AMS.