loyalty_profiles


Columns

Column Type Size Nulls Auto Default Children Parents Comments
id uuid 2147483647 gen_random_uuid()
loyalty_point_adjustments.loyalty_profile_id loyalty_point_adjustments_loyalty_profile_id_fkey C
practice_id text 2147483647 null
schema_migrations.id Implied Constraint R
patient_id text 2147483647 null
schema_migrations.id Implied Constraint R
program_key text 2147483647 'colorscience'::text
status text 2147483647 'registered'::text
points_balance int4 10 0
first_name text 2147483647 √ null
last_name text 2147483647 √ null
email text 2147483647 √ null
phone text 2147483647 √ null
postal_code text 2147483647 √ null
birth_month int4 10 √ null
birth_day int4 10 √ null
consented_at timestamptz 35,6 √ null
registered_at timestamptz 35,6 now()
created_at timestamptz 35,6 now()
updated_at timestamptz 35,6 now()

Indexes

Constraint Name Type Sort Column(s)
loyalty_profiles_pkey Primary key Asc id
loyalty_profiles_patient_idx Performance Asc/Asc practice_id + patient_id
loyalty_profiles_practice_id_patient_id_program_key_key Must be unique Asc/Asc/Asc practice_id + patient_id + program_key
loyalty_profiles_program_status_idx Performance Asc/Asc/Asc practice_id + program_key + status

Check Constraints

Constraint Name Constraint
loyalty_profiles_status_check ((status = ANY (ARRAY['registered'::text, 'inactive'::text])))
loyalty_profiles_birth_month_check (((birth_month IS NULL) OR ((birth_month >= 1) AND (birth_month <= 12))))
loyalty_profiles_birth_day_check (((birth_day IS NULL) OR ((birth_day >= 1) AND (birth_day <= 31))))
loyalty_profiles_points_balance_check ((points_balance >= 0))

Relationships