👤 Users & Authentication 3 tables
users
RLS 14 cols
Master user record for all user types (breeder, buyer, admin). Links to Supabase Auth via auth_uid.
ColumnTypeInfo
idUUIDPK, gen_random_uuid()
auth_uidUUIDUNIQUE — Supabase Auth link
emailTEXTUNIQUE NOT NULL, regex check
user_typeTEXTCHECK: breeder | buyer | admin
display_nameTEXT
photo_urlTEXT
phone_numberTEXT
is_activeBOOLEANDEFAULT true
email_verifiedBOOLEANDEFAULT false
phone_verifiedBOOLEANDEFAULT false
created_atTIMESTAMPTZDEFAULT NOW()
updated_atTIMESTAMPTZDEFAULT NOW()
last_login_atTIMESTAMPTZ
deleted_atTIMESTAMPTZSoft delete
RLS Policies
• Users can view own profile (SELECT where auth.uid() = auth_uid)
• Users can update own profile (UPDATE where auth.uid() = auth_uid)
• Admins can view all users (SELECT where user_type = 'admin')
Indexes
idx_users_emailidx_users_user_typeidx_users_auth_uid
Repository
UserRepository
breeder_profiles
3 JSONB 36 cols
Extended public profile for breeders: business info, location, verification, gallery, stats. 1:1 with users.
ColumnTypeInfo
idUUIDPK
user_idUUIDFK → users(id) UNIQUE, CASCADE
breeder_nameTEXTNOT NULL
slugTEXTUNIQUE NOT NULL
descriptionTEXT
bioTEXT
established_yearINTEGER
street_addressTEXT
cityTEXT
state_provinceTEXT
postal_codeTEXT
countryTEXTDEFAULT 'Switzerland'
latitudeDECIMAL(10,8)GIST index for geo search
longitudeDECIMAL(11,8)
website_urlTEXT
facebook_urlTEXT
instagram_urlTEXT
whatsapp_numberTEXT
verification_statusTEXTCHECK: pending | verified | rejected | suspended
verified_atTIMESTAMPTZ
verification_notesTEXT
languagesTEXT[]DEFAULT ['German']
specializationsTEXT[]
certificationsJSONB[{name, issuer, date, expiry, document_url}]
profile_image_urlTEXT
cover_image_urlTEXT
gallery_imagesTEXT[]
is_publicBOOLEANDEFAULT true
accepts_applicationsBOOLEANDEFAULT true
show_exact_locationBOOLEANDEFAULT false
notification_preferencesJSONB
total_litters, total_puppiesINTEGERDenormalized stats
average_ratingDECIMAL(3,2)Denormalized
total_reviewsINTEGERDenormalized
onboarding_completedBOOLEAN
onboarding_stepINTEGER
custom_fieldsJSONB
stripe_connect_idTEXTFallback — primary link via stripe_connect_accounts
payments_enabledBOOLEANDEFAULT false
suspended_untilTIMESTAMPTZModeration
created_atTIMESTAMPTZDEFAULT NOW()
updated_atTIMESTAMPTZDEFAULT NOW()
Indexes
idx_breeder_profiles_user_ididx_breeder_profiles_slugidx_breeder_profiles_verification_statusGIST ll_to_earth(lat,lng)
Repository
BreederProfileRepository
buyer_profiles
2 JSONB 33 cols
Buyer profile with household info, lifestyle, dog preferences, and profile completion state. 1:1 with users.
ColumnTypeInfo
idUUIDPK
user_idUUIDFK → users(id) UNIQUE, CASCADE
first_nameTEXT
last_nameTEXT
date_of_birthDATE
occupationTEXT
cityTEXT
state_provinceTEXT
postal_codeTEXT
countryTEXTDEFAULT 'Switzerland'
housing_typeTEXTCHECK: apartment | house | farm | other
has_yardBOOLEAN
yard_sizeTEXTCHECK: none | small | medium | large
owns_or_rentsTEXTCHECK: own | rent
dog_experience_levelTEXTCHECK: first_time | some_experience | experienced | expert
previous_breedsTEXT[]
preferred_breedsTEXT[]
lifestyle_quiz_resultsJSONBQuiz answers + preferences
household_adultsINTEGER
household_childrenINTEGER
children_agesINTEGER[]
other_petsJSONB[{type, breed, age, temperament}]
work_scheduleTEXTCHECK: home | office_fulltime | etc.
daily_absence_hoursINTEGER
preferred_genderTEXTCHECK: male | female | no_preference
preferred_age_rangeTEXTCHECK: puppy | young | adult | any
preferred_sizeTEXTCHECK: small | medium | large | giant | any
max_priceDECIMAL(10,2)
why_want_dogTEXT
specific_requirementsTEXT
allergiesTEXT[]
profile_completedBOOLEANDEFAULT false
profile_approvedBOOLEANDEFAULT false
Repository
BuyerProfileRepository
🐕 Listings & Breeding 7 tables
dog_breeds
30+ cols
Master breed data: size, temperament traits (1-5 scale), compatibility, care needs. Full-text GIN search index.
ColumnTypeInfo
idUUIDPK
nameTEXTUNIQUE NOT NULL
name_deTEXTGerman name
breed_groupTEXT
size_categoryTEXTCHECK: small | medium | large | giant
weight_min_kg, weight_max_kgDECIMAL(5,2)
height_min_cm, height_max_cmDECIMAL(5,2)
life_expectancy_min, _maxINTEGER
energy_level, exercise_needs, grooming_needs, shedding_level, trainability, intelligenceINTEGERCHECK 1–5
good_with_children, _dogs, _cats, _strangersINTEGERCHECK 1–5
barking_tendency, prey_drive, wanderlustINTEGERCHECK 1–5
apartment_friendly, novice_friendlyBOOLEAN
cold_weather_tolerance, hot_weather_toleranceINTEGERCHECK 1–5
description, history, care_instructionsTEXT
health_issuesTEXT[]
Repository
BreedRepository
dogs
3 JSONB27 cols
Breeder-owned breeding dogs (sires & dams). Tracks health tests, achievements, breeding status.
ColumnTypeInfo
idUUIDPK
breeder_idUUIDFK → users(id) CASCADE
nameTEXTNOT NULL
registration_nameTEXT
breed_idUUIDFK → dog_breeds(id)
breed_nameTEXTDenormalized
genderTEXTCHECK: male | female
birth_dateDATENOT NULL
colorTEXT
weight_kgDECIMAL(5,2)
registration_numberTEXT
microchip_numberTEXT
pedigree_urlTEXT
health_testsJSONB[{test_name, date, result, certificate_url}]
vaccinationsJSONB[{vaccine, date, next_due}]
breeding_statusTEXTCHECK: active | retired | not_breeding
first_heat_dateDATE
breeding_restrictionsTEXT
profile_image_urlTEXT
achievementsJSONB[{title, date, org}]
titlesTEXT[]Show titles
gallery_imagesTEXT[]
is_activeBOOLEANDEFAULT true
is_publicBOOLEANDEFAULT true
created_atTIMESTAMPTZDEFAULT NOW()
updated_atTIMESTAMPTZDEFAULT NOW()
deleted_atTIMESTAMPTZSoft delete
Indexes
idx_dogs_breeder_ididx_dogs_breed_ididx_dogs_genderidx_dogs_breeding_status
Repository
DogRepository
litters
1 JSONB20 cols
Planned/active/completed litters with parent pairing, dates, and waitlist status.
ColumnTypeInfo
idUUIDPK
breeder_idUUIDFK → users(id) CASCADE
mother_idUUIDFK → dogs(id)
father_idUUIDFK → dogs(id)
father_external_infoJSONBIf father not owned by breeder
litter_name, breed_nameTEXT
breed_idUUIDFK → dog_breeds(id)
mating_date, expected_date, birth_date, ready_dateDATE
expected_puppies, born_puppies, available_puppiesINTEGER
statusTEXTCHECK: planned | pregnant | born | ready | closed
waitlist_openBOOLEAN
waitlist_spotsINTEGER
imagesTEXT[]
Repository
LitterRepository
puppies
RLS4 JSONB30 cols
Individual puppies: listing, health, pricing, reservation lifecycle. AI match profile for buyer matching.
ColumnTypeInfo
idUUIDPK
breeder_idUUIDFK → users(id) CASCADE
litter_idUUIDFK → litters(id) SET NULL
breed_idUUIDFK → dog_breeds(id)
name, registration_name, breed_nameTEXT
genderTEXTCHECK: male | female
birth_dateDATENOT NULL
color, coat_type, expected_sizeTEXT
current_weight_kgDECIMAL(5,2)
personality_traitsJSONB{playful: 4, calm: 2, …}
ai_match_profileJSONBGenerated matching profile
vaccinationsJSONB
vet_checksJSONB
deworming_datesDATE[]
priceDECIMAL(10,2)
statusTEXTCHECK: available | reserved | sold | keeping
reserved_byUUIDFK → users(id)
sold_toUUIDFK → users(id)
gallery_images, video_urlsTEXT[]
RLS Policies
• Public can view available puppies (status = 'available' AND breeder is_public)
• Breeders can manage own puppies (breeder_id matches auth user)
Indexes
GIN full-text searchidx_puppies_statusidx_puppies_listing (partial composite)idx_puppies_price
Repository
PuppyRepository
rehoming_dogs
28 cols
Dogs listed for rehoming by owners. Includes behavior, compatibility, urgency, and requirements.
ColumnTypeInfo
idUUIDPK
owner_idUUIDFK → users(id) CASCADE
breed_idUUIDFK → dog_breeds(id)
name, breed_nameTEXT
genderTEXTCHECK: male | female
weight_kg, size, colorDECIMAL / TEXT
neutered, vaccinated, microchippedBOOLEAN
house_trained, crate_trained, leash_trainedBOOLEAN
good_with_children, _dogs, _cats, _strangersBOOLEAN
rehoming_reasonTEXTNOT NULL
urgencyTEXTCHECK: low | medium | high | urgent
rehoming_feeDECIMAL(10,2)
statusTEXTCHECK: available | pending | rehomed
heat_cycles
Not in schema doc
Tracks heat cycles for breeding females. Found in breeder_portal migration.
Repository
HeatCycleRepository
Source
Migration: 20240501000000_breeder_portal.sql
expected_litters
Not in schema doc
Pre-litter planning: expected date, pregnancy confirmation, waitlist settings. Used by InquiryRepository.
ColumnTypeInfo
idUUIDPK
breeder_idUUIDFK → users(id)
expected_dateDATENOT NULL
date_confirmedBOOLEAN
pregnancy_confirmedBOOLEAN
mother_idUUIDFK → dogs(id)
father_idUUIDFK → dogs(id)
breed_idUUIDFK → dog_breeds(id)
expected_puppies, max_waitlist_spotsINTEGER
waitlist_openBOOLEAN
Repository
InquiryRepository (getExpectedLitters)
💬 Communication & Inquiries 9 tables
inquiries
RLSNot in schema doc
Central inquiry system: buyer-to-breeder communication with compatibility scoring, auto-reject, and status workflow.
ColumnTypeInfo
idUUIDPK
buyer_idUUIDFK → users(id) CASCADE
breeder_idUUIDFK → users(id) CASCADE
puppy_idUUIDFK → puppies(id) SET NULL
litter_idUUIDFK → litters(id) SET NULL
statusVARCHAR(50)open | weitere_angaben | warteliste | abgelehnt | reserviert | abgeschlossen
compatibility_scoreDECIMAL(3,2)0.00 to 1.00
breeder_rankingINTEGERBreeder preference order
auto_reject_dateTIMESTAMPTZ
initial_messageTEXT
breeder_notesTEXT
waitlist_expiry_dateTIMESTAMPTZ
Repository
InquiryRepository — the most complex repository with CRUD, messaging, payments, reservations, waitlist, FAQ, and auto-rejection.
inquiry_messages
1 JSONBNot in schema doc
Chat messages within an inquiry. Supports AI responses and attachments.
ColumnTypeInfo
idUUIDPK
inquiry_idUUIDFK → inquiries(id) CASCADE
sender_idUUIDFK → users(id) CASCADE
messageTEXTNOT NULL
is_ai_responseBOOLEANDEFAULT false
attachmentsJSONB[{url, name, type, size}]
read_atTIMESTAMPTZ
read_byUUIDFK → users(id)
inquiry_preferences
Not in schema doc
Buyer preferences per inquiry: breed, color, sex, count.
ColumnTypeInfo
inquiry_idUUIDFK → inquiries(id)
breed_idUUID
breed_nameTEXT
color_coat_preferenceTEXT
sex_preferenceTEXTDEFAULT 'no_preference'
puppy_countINTEGERDEFAULT 1
inquiry_status_history
Not in schema doc
Audit trail for inquiry status changes.
ColumnTypeInfo
inquiry_idUUIDFK → inquiries(id)
old_statusTEXT
new_statusTEXT
changed_byTEXT
reasonTEXT
metadataJSONB
chat_rooms
10 cols
Legacy direct message rooms with polymorphic context (application/puppy_inquiry).
ColumnTypeInfo
idUUIDPK
participant_idsUUID[]GIN index
context_typeTEXTCHECK: general | application | puppy_inquiry
context_idUUIDPolymorphic — not FK enforced
is_activeBOOLEAN
blocked_byUUIDFK → users(id)
last_message_atTIMESTAMPTZ
last_message_previewTEXT
Repository
ChatRoomRepository
messages
RLS2 JSONB
Individual chat messages within legacy chat_rooms. Partitioned by month.
ColumnTypeInfo
idUUIDPK
chat_room_idUUIDFK → chat_rooms(id) CASCADE
sender_idUUIDFK → users(id)
contentTEXTNOT NULL
message_typeTEXTCHECK: text | image | document | system
attachmentsJSONB[{url, type, name, size}]
is_readBOOLEAN
is_editedBOOLEAN
metadataJSONB
RLS Policies
• Users can view own messages (sender or chat participant)
• Users can send messages (only to rooms they participate in)
Repository
MessageRepository
notifications
12 cols
In-app, email, and SMS notification records with delivery status.
ColumnTypeInfo
idUUIDPK
user_idUUIDFK → users(id) CASCADE
typeTEXTNOT NULL
title, bodyTEXTNOT NULL
entity_type, entity_idTEXT / UUIDContext reference
action_urlTEXT
is_readBOOLEANDEFAULT false
channelsTEXT[]DEFAULT ['in_app']
email_sent, sms_sentBOOLEAN
breeder_faqs
1 JSONBNot in schema doc
Breeder FAQ configurations with AI auto-response capability.
ColumnTypeInfo
idUUIDPK
breeder_idUUIDFK → users(id) CASCADE
is_activeBOOLEANDEFAULT true
ai_enabledBOOLEANDEFAULT true
ai_promptTEXTCustom AI instructions
faq_itemsJSONB[{question, answer, category, order}]
auto_response_delay_minutesINTEGERDEFAULT 0
auto_rejection_rules
Not in schema doc
Configurable auto-rejection rules per breeder based on profile completeness and compatibility scores.
ColumnTypeInfo
idUUIDPK
breeder_idUUIDFK → users(id)
is_activeBOOLEAN
no_profile_photoBOOLEAN
incomplete_profileBOOLEAN
no_response_daysINTEGER
minimum_compatibility_scoreDECIMAL
rejection_messageTEXT
💰 Payments & Subscriptions 5 tables
payments
1 JSONBNot in schema doc
Payment requests and Stripe transactions for reservation deposits and final payments.
ColumnTypeInfo
idUUIDPK
inquiry_idUUIDFK → inquiries(id) CASCADE
typeVARCHAR(50)reservation_deposit | final_payment
amountDECIMAL(10,2)NOT NULL
currencyVARCHAR(3)DEFAULT 'CHF'
statusVARCHAR(50)pending | processing | completed | failed | refunded | cancelled
stripe_payment_intent_idVARCHAR(255)
stripe_checkout_session_idVARCHAR(255)
payment_methodVARCHAR(50)card | bank_transfer | twint
paid_at, refunded_atTIMESTAMPTZ
metadataJSONB
reservations
Not in schema doc
Puppy reservations with confirmation number, pickup details, and deposit link.
ColumnTypeInfo
idUUIDPK
inquiry_idUUIDFK → inquiries(id) CASCADE
deposit_payment_idUUIDFK → payments(id)
expected_pickup_date, actual_pickup_dateDATE
pickup_locationTEXT
confirmation_numberTEXT
notify_other_breedersBOOLEAN
notesTEXT
subscriptions
Not in schema docRepo
Breeder subscriptions with Stripe integration. Tiers: free, premium.
ColumnTypeInfo
idUUIDPK (inferred)
breeder_idUUIDFK → users(id) UNIQUE
stripe_subscription_idTEXT
stripe_customer_idTEXT
tierTEXTfree | premium
statusTEXTactive | past_due | canceled
current_period_endTIMESTAMPTZ
Repository
SubscriptionRepository — noted as "not yet in generated Supabase types"
stripe_connect_accounts
RLSNot in schema doc
Stripe Connect onboarding for breeder payouts. Linked from breeder_profiles.
ColumnTypeInfo
idUUIDPK
breeder_idUUIDFK → users(id) UNIQUE
stripe_account_idTEXTUNIQUE NOT NULL
onboarding_completeBOOLEAN
charges_enabledBOOLEAN
payouts_enabledBOOLEAN
Repository
StripeConnectRepository
webhook_events
Not in schema doc
Idempotent Stripe webhook event log for deduplication.
🌐 Breeder Sites 6 tables
breeder_sites
Not in schema docRepo
Premium AI-built breeder websites: tier (free/premium), custom domain, theme, publish status.
ColumnTypeInfo
idUUIDPK
breeder_idUUIDFK → users(id)
tierTEXTCHECK: free | premium
themeTEXT
custom_domainTEXT
is_publishedBOOLEANDEFAULT false
Repository
BreederSiteRepository
breeder_site_pages
1 JSONBNot in schema doc
Page builder pages for breeder sites: templates, sections (JSONB), nav order.
ColumnTypeInfo
idUUIDPK
site_idUUIDFK → breeder_sites(id) CASCADE
page_typeTEXT
template_idTEXT
nav_labelTEXT
nav_orderINTEGER
sectionsJSONBSection instances array
is_published, is_visibleBOOLEAN
Repository
BreederSitePageRepository
breeder_pages
RLS1 JSONBNot in schema doc
Legacy Puck page builder data for breeder websites.
ColumnTypeInfo
idUUIDPK
breeder_idTEXTNOT NULL
slugTEXTUNIQUE per breeder
titleTEXT
puck_dataJSONBPage builder data
is_published, is_homepageBOOLEAN
sort_orderINTEGER
Repository
BreederPageRepository
breeder_media
Not in schema doc
Media library for breeder sites: images, videos, documents with storage paths.
ColumnTypeInfo
idUUIDPK
breeder_idUUIDFK → users(id) CASCADE
file_typeTEXTCHECK: image | video | document
storage_path, filename, mime_typeTEXT
size_bytesBIGINT
thumbnail_pathTEXT
is_publicBOOLEAN
Repository
BreederMediaRepository
breeder_media_usage
Not in schema doc
Tracks where media is used across breeder site pages.
anonymous_leads
Not in schema doc
Lead capture from breeder site visitors before they sign up.
Repository
AnonymousLeadRepository
📋 Compliance & Regulations 12 tables
cantons
Not in schema doc
Swiss cantons master data with multilingual names (DE/FR/IT).
ColumnTypeInfo
idUUIDPK
canton_codeVARCHAR(2)UNIQUE NOT NULL
canton_nameVARCHAR(100)NOT NULL
canton_name_de, _fr, _itVARCHAR(100)Multilingual
cantonal_breed_regulations
Not in schema doc
Per-canton breed legal status: permits, blood percentage thresholds, effective dates.
ColumnTypeInfo
idUUIDPK
canton_idUUIDFK → cantons(id)
breed_idUUIDFK → dog_breeds(id)
status_idUUIDFK → cantonal_legal_status_types(id)
effective_dateDATEUNIQUE(canton_id, breed_id, effective_date)
blood_percentage_thresholdDECIMAL(5,2)
requires_permitBOOLEAN
legal_referenceTEXT
cantonal_dog_regulations
Not in schema doc
General dog regulations per canton: training, leashing, fines. Multilingual (DE/FR/IT).
cantonal_training_requirements
Not in schema doc
Canton-specific dog training requirements.
cantonal_breed_categories
Not in schema doc
Breed category definitions per canton (e.g., Rassetypenliste I/II in Zürich). Maps breeds to cantonal risk tiers.
ColumnTypeInfo
idUUIDPK
canton_idUUIDFK → cantons(id)
category_nameTEXTe.g. "Rassetypenliste I"
risk_levelINTEGERCategory severity tier
descriptionTEXT
legal_referenceTEXT
cantonal_restricted_areas
Not in schema doc
Area types and restriction types per canton: banned/leash/muzzle zones, seasonal periods, time windows, fine amounts.
ColumnTypeInfo
idUUIDPK
canton_idUUIDFK → cantons(id)
area_typeTEXTpark | playground | nature_reserve | public_transport | etc.
restriction_typeTEXTbanned | leash_required | muzzle_required
seasonal_start, seasonal_endDATEOptional seasonal window
fine_amountDECIMAL(10,2)CHF fine if applicable
descriptionTEXT
breed_regulations
1 JSONBNot in schema doc
Club-level breeding rules: age limits, litter caps, mandatory tests, certifications.
ColumnTypeInfo
idUUIDPK
breed_nameTEXTNOT NULL
source_clubTEXT
min_dam_age_months, max_dam_age_monthsINTEGER
min_sire_age_months, max_sire_age_monthsINTEGER
max_litters_per_year, max_litters_lifetimeINTEGER
min_litter_interval_monthsINTEGER
mandatory_training, required_certificationsTEXT[]
additional_rulesJSONB
Repository
BreedRegulationRepository
breed_guideline_documents
Not in schema doc
Downloadable guideline PDFs per breed from clubs.
breeder_compliance_steps
Not in schema doc
Per-breeder compliance checklist tracking (e.g. health tests done, registrations completed).
Repository
ComplianceRepository
breed_health_requirements
Not in schema doc
Required health screenings per breed (hip scores, eye tests, etc.).
Engagement & Tracking 14 tables
applications
3 JSONB22 cols
Buyer applications for puppies, litter waitlists, or rehoming — the full workflow from submission to decision.
ColumnTypeInfo
idUUIDPK
applicant_idUUIDFK → users(id) CASCADE
breeder_idUUIDFK → users(id)
application_typeTEXTCHECK: puppy | litter_waitlist | rehoming
puppy_idUUIDFK → puppies(id)
litter_idUUIDFK → litters(id)
rehoming_dog_idUUIDFK → rehoming_dogs(id)
introduction_messageTEXTNOT NULL
questionnaire_answersJSONB
referencesJSONB[{name, relationship, contact}]
veterinarian_infoJSONB
statusTEXTCHECK: pending | under_review | approved | rejected | withdrawn
reviewed_byUUIDFK → users(id)
Repository
ApplicationRepository
waitlists
12 cols
Ordered user queue per litter with gender/color preferences and offer tracking.
ColumnTypeInfo
idUUIDPK
litter_idUUIDFK → litters(id) CASCADE
user_idUUIDFK → users(id) CASCADE
positionINTEGER
gender_preferenceTEXTCHECK: male | female | no_preference
statusTEXTCHECK: active | offered | accepted | declined | expired
offered_puppy_idUUIDFK → puppies(id)
response_deadlineTIMESTAMPTZ
reviews
16 cols
Buyer reviews of breeders with multi-dimensional ratings and breeder response.
ColumnTypeInfo
idUUIDPK
reviewer_idUUIDFK → users(id)
breeder_idUUIDFK → users(id)
puppy_idUUIDFK → puppies(id)
overall_ratingINTEGERCHECK 1–5
communication_rating, puppy_health_rating, accuracy_ratingINTEGERCHECK 1–5
title, contentTEXT
breeder_responseTEXT
is_verified_purchaseBOOLEAN
Repository
ReviewRepository
favorite_puppies
Composite PK
Junction: user ↔ bookmarked puppies.
favorite_breeders
Composite PK
Junction: user ↔ bookmarked breeders.
favorite_litters
Not in schema doc
Junction: user ↔ bookmarked litters.
favorite_dogs
Not in schema doc
Junction: user ↔ bookmarked breeding dogs.
favorite_breeds
Not in schema doc
Junction: user ↔ bookmarked breeds.
breeder_blog_posts
16 cols
Breeder-authored content/blog posts with optional litter/dog links.
Repository
BreederBlogRepository
user_activities
1 JSONB8 cols
Activity/audit-style tracking with IP, user agent, and metadata.
Repository
UserActivityRepository
user_views
Not in schema doc
Tracks entity view counts per user.
user_interactions
Not in schema doc
Tracks user interaction events (clicks, shares, etc.).
breeder_waitlist_settings
Not in schema doc
Per-breeder waitlist configuration and preferences.
🏛️ Rasseklub / SKG 9 tables
breed_clubs
Not in schema doc
SKG breed club master data. 112 clubs seeded. Core reference for the club admin system.
ColumnTypeInfo
idUUIDPK
nameTEXTNOT NULL
abbreviationTEXT
breed_idUUIDFK → dog_breeds(id)
website_urlTEXT
contact_emailTEXT
Repository
BreedClubRepository
breed_club_events
Not in schema doc
Club events: shows, meetings, training days.
ColumnTypeInfo
idUUIDPK
club_idUUIDFK → breed_clubs(id)
event_nameTEXTNOT NULL
event_dateDATE
locationTEXT
breeder_breeds
Not in schema doc
Junction: breeder ↔ breed. Which breeds a breeder works with.
ColumnTypeInfo
breeder_idUUIDFK → users(id)
breed_idUUIDFK → dog_breeds(id)
Repository
BreederBreedRepository
breeder_clubs
Not in schema doc
Junction: breeder ↔ club with membership number.
ColumnTypeInfo
breeder_idUUIDFK → users(id)
club_idUUIDFK → breed_clubs(id)
membership_numberTEXT
Repository
BreederClubRepository
club_users
RLSNot in schema doc
Independent club-tool user identity. Links to Supabase Auth. Separate from marketplace users.
ColumnTypeInfo
idUUIDPK
auth_uidUUIDLinks to auth.users
emailTEXTNOT NULL
first_nameTEXT
last_nameTEXT
phoneTEXT
RLS Policies
• User can read/update own record (auth_uid = auth.uid())
• Insert own record on signup
Repository
ClubUserRepository
club_memberships
RLSNot in schema doc
>Links club_user to breed_club with role (admin/zuchtwart/member) and status. One user can belong to multiple clubs.
ColumnTypeInfo
idUUIDPK
club_user_idUUIDFK → club_users(id)
club_idUUIDFK → breed_clubs(id)
roleTEXTCHECK: admin | zuchtwart | member
statusTEXTCHECK: active | inactive | pending
membership_numberTEXT
RLS Policies
• Readable within own club
• Insert/update/delete restricted to club admins
• Bootstrap logic for first admin
club_breeders
RLSNot in schema doc
>Club-context breeder profile. Kennel name, breeding approval, facility inspection. Optional bridge to WelpenMatch via welpenmatch_profile_id.
ColumnTypeInfo
idUUIDPK
club_membership_idUUIDFK → club_memberships(id)
kennel_nameTEXT
breeding_approval_statusTEXT
facility_inspection_statusTEXT
welpenmatch_profile_idUUIDFK → breeder_profiles(id) — bridge to marketplace
RLS Policies
• Access propagated through club membership and role checks
• Breeders can view/update own record
club_dogs
RLSNot in schema doc
>Club-registered breeding dogs. Registration number, microchip, breed details. Linked to club_breeders.
ColumnTypeInfo
idUUIDPK
club_breeder_idUUIDFK → club_breeders(id)
registration_numberTEXT
nameTEXTNOT NULL
breed_idUUIDFK → dog_breeds(id)
sexTEXTCHECK: male | female
birth_dateDATE
microchip_numberTEXT
colorTEXT
markingsTEXT
RLS Policies
• Access propagated through club membership
• Breeders manage own dogs
health_tests
RLSNot in schema doc
>Per-dog health certificates and test results. Verified by Zuchtwart/admin. Core of the compliance pipeline.
ColumnTypeInfo
idUUIDPK
club_dog_idUUIDFK → club_dogs(id)
test_typeTEXTe.g. HD, ED, eye test
resultTEXT
certificate_urlTEXT
verified_byUUIDFK → club_users(id)
verified_atTIMESTAMPTZ
RLS Policies
• Access propagated through club membership
• Breeders manage own dog tests
• Zuchtwarte can verify
📊 Admin & Operations 12 tables
audit_log
1 JSONB
Generic audit trail for operational/security logging via trigger.
ColumnTypeInfo
idUUIDPK
table_nameTEXTNOT NULL
operationTEXTNOT NULL
user_idUUIDNot FK-enforced
changed_dataJSONB
platform_reports
RLSNot in schema doc
Off-platform solicitation reports. Buyers can anonymously report breeders bypassing the platform.
ColumnTypeInfo
idUUIDPK
reporter_idUUIDFK → users(id)
reported_breeder_idUUIDFK → users(id)
inquiry_idUUIDFK → inquiries(id)
reasonTEXToff_platform_payment | external_contact | pressure_to_bypass
statusTEXTpending | valid | invalid | needs_info
reviewed_byUUIDFK → users(id)
Repository
PlatformReportRepository
breeder_violations
RLSNot in schema doc
3-strikes moderation: warning → suspension → ban. Links to platform reports.
ColumnTypeInfo
idUUIDPK
breeder_idUUIDFK → users(id)
report_idUUID
strike_numberINTEGERCHECK 1–3
actionTEXTwarning | suspension | ban
revokedBOOLEAN
suspension_untilTIMESTAMPTZ
issued_byUUIDFK → users(id)
Repository
BreederViolationRepository
dog_ownership_records
RLSNot in schema doc
Chain of ownership for dogs purchased via the platform. Links buyer, breeder, puppy, and payment.
ColumnTypeInfo
idUUIDPK
puppy_idUUIDFK → puppies(id)
litter_idUUIDFK → litters(id)
buyer_idUUIDFK → users(id)
breeder_idUUIDFK → users(id)
inquiry_idUUIDFK → inquiries(id)
payment_idUUIDFK → payments(id)
transfer_typeTEXTsale | rehoming | return_to_breeder
transfer_dateTIMESTAMPTZ
Repository
DogOwnershipRepository
rehoming_requests
RLSNot in schema doc
Buyer-initiated rehoming workflow: return to breeder or find new home.
ColumnTypeInfo
idUUIDPK
ownership_record_idUUIDFK → dog_ownership_records(id)
requester_idUUIDFK → users(id)
reasonTEXTNOT NULL
preferred_outcomeTEXTreturn_to_breeder | find_new_home
statusTEXTrequested | breeder_contacted | breeder_accepted | platform_handling | resolved
Repository
RehomingRequestRepository
support_tickets
RLSNot in schema doc
User support tickets created via Telegram bot.
ColumnTypeInfo
idUUIDPK
user_idUUIDFK → users(id) CASCADE
chat_idBIGINTTelegram chat ID
categoryTEXTtechnical | account | payment | other
descriptionTEXT
statusTEXTopen | in_progress | resolved | closed
attachment_urlsTEXT[]
email_subscriptions
Not in schema doc
Email subscription preferences per user.
email_send_log
Not in schema doc
Transactional email delivery log.
telegram_bot_sessions
Not in schema doc
Telegram bot conversation state persistence.
signup_attempts
Not in schema doc
Rate limiting for signup attempts.
import_records + related
Not in schema doc
Data import tracing: import_records, import_documents, import_timeline_events, import_vaccination_records.

Entity Relationship Diagram

Core tables and foreign-key relationships. Scroll/zoom to explore.

erDiagram
    users ||--o| breeder_profiles : "1:1 profile"
    users ||--o| buyer_profiles : "1:1 profile"
    users ||--o{ dogs : "owns"
    users ||--o{ litters : "creates"
    users ||--o{ puppies : "lists"
    users ||--o{ rehoming_dogs : "owns"
    users ||--o{ inquiries : "buyer"
    users ||--o{ inquiries : "breeder"
    users ||--o{ applications : "submits"
    users ||--o{ applications : "receives"
    users ||--o{ notifications : "receives"
    users ||--o{ reviews : "writes"
    users ||--o{ reviews : "reviewed"
    users ||--o{ waitlists : "joins"
    users ||--o{ breeder_blog_posts : "writes"
    users ||--o{ user_activities : "generates"
    users ||--o{ favorite_puppies : "saves"
    users ||--o{ favorite_breeders : "saves"
    users ||--o{ messages : "sends"
    users ||--o| subscriptions : "has"
    users ||--o| stripe_connect_accounts : "has"

    dog_breeds ||--o{ dogs : "classifies"
    dog_breeds ||--o{ litters : "classifies"
    dog_breeds ||--o{ puppies : "classifies"
    dog_breeds ||--o{ rehoming_dogs : "classifies"
    dog_breeds ||--o{ cantonal_breed_regulations : "regulated"
    dog_breeds ||--o{ breed_clubs : "associated"
    dog_breeds ||--o{ club_dogs : "classifies"

    dogs ||--o{ litters : "mother"
    dogs ||--o{ litters : "father"
    dogs ||--o{ expected_litters : "parent"

    litters ||--o{ puppies : "contains"
    litters ||--o{ waitlists : "has"
    litters ||--o{ applications : "target"
    litters ||--o{ breeder_blog_posts : "referenced"

    puppies ||--o{ applications : "target"
    puppies ||--o{ reviews : "about"
    puppies ||--o{ waitlists : "offered"
    puppies ||--o{ favorite_puppies : "favorited"
    puppies ||--o{ dog_ownership_records : "transferred"

    rehoming_dogs ||--o{ applications : "target"

    inquiries ||--o{ inquiry_messages : "has"
    inquiries ||--o{ inquiry_preferences : "has"
    inquiries ||--o{ inquiry_status_history : "tracks"
    inquiries ||--o{ payments : "paid_via"
    inquiries ||--o{ reservations : "reserved_via"
    inquiries ||--o{ platform_reports : "reported"
    inquiries ||--o{ dog_ownership_records : "resulted_in"

    payments ||--o{ reservations : "deposit"

    chat_rooms ||--o{ messages : "contains"

    breeder_sites ||--o{ breeder_site_pages : "has"

    cantons ||--o{ cantonal_breed_regulations : "has"
    cantons ||--o{ cantonal_dog_regulations : "has"
    cantons ||--o{ cantonal_breed_categories : "has"
    cantons ||--o{ cantonal_restricted_areas : "has"

    dog_ownership_records ||--o{ rehoming_requests : "has"

    breed_clubs ||--o{ breed_club_events : "has"
    breed_clubs ||--o{ breeder_clubs : "has"
    breed_clubs ||--o{ club_memberships : "has"

    club_users ||--o{ club_memberships : "has"
    club_memberships ||--o{ club_breeders : "has"
    club_breeders ||--o{ club_dogs : "has"
    club_dogs ||--o{ health_tests : "has"

    breeder_violations }o--|| users : "breeder"
    platform_reports }o--|| users : "reporter"

    users {
        uuid id PK
        uuid auth_uid UK
        text email UK
        text user_type
    }
    breeder_profiles {
        uuid id PK
        uuid user_id FK
        text breeder_name
        text slug UK
        text verification_status
    }
    buyer_profiles {
        uuid id PK
        uuid user_id FK
    }
    dogs {
        uuid id PK
        uuid breeder_id FK
        uuid breed_id FK
        text gender
        text breeding_status
    }
    litters {
        uuid id PK
        uuid breeder_id FK
        uuid mother_id FK
        uuid father_id FK
        text status
    }
    puppies {
        uuid id PK
        uuid breeder_id FK
        uuid litter_id FK
        uuid breed_id FK
        text status
        decimal price
    }
    inquiries {
        uuid id PK
        uuid buyer_id FK
        uuid breeder_id FK
        text status
        decimal compatibility_score
    }
    payments {
        uuid id PK
        uuid inquiry_id FK
        decimal amount
        text status
    }
    subscriptions {
        uuid id PK
        uuid breeder_id FK
        text tier
        text status
    }
    club_users {
        uuid id PK
        uuid auth_uid
        text email
    }
    club_memberships {
        uuid id PK
        uuid club_user_id FK
        uuid club_id FK
        text role
    }
    club_breeders {
        uuid id PK
        uuid club_membership_id FK
        text kennel_name
    }
    club_dogs {
        uuid id PK
        uuid club_breeder_id FK
        text registration_number
    }
    health_tests {
        uuid id PK
        uuid club_dog_id FK
        text test_type
        text result
    }
      

Key Data Flows

How data moves through the system for core business processes.

🐕 Buyer Inquiry Flow
1
Buyer browses puppies / litterstracked in user_activities
2
Sends inquiry → inquiries + inquiry_preferences created
3
Chat begins → inquiry_messages >(with optional AI auto-response from breeder_faqs)
4
Status changes tracked in inquiry_status_history
5
If approved → paymentsreservationsdog_ownership_records
🏠 Breeder Onboarding
1
Sign up → users >(user_type = 'breeder')
2
Complete profile → breeder_profiles >(9-step onboarding)
3
Register breeds → breeder_breeds + breeder_clubs
4
Compliance checks → breeder_compliance_steps
5
Subscription → subscriptions + stripe_connect_accounts
6
Add dogs → dogsCreate littersList puppies
💳 Payment Flow
1
Inquiry status → 'reserviert'
2
>Deposit request created → payments >(type = 'reservation_deposit')
3
Stripe checkout → webhook → webhook_events >(idempotent)
4
Payment confirmed → reservations >created with confirmation number
5
On pickup → dog_ownership_records + puppies.status → 'sold'
⚖️ Moderation Flow
1
>Buyer reports breeder → platform_reports
2
Admin reviews → valid/invalid
3
>If valid → strike issued → breeder_violations >(1=warning, 2=suspension, 3=ban)
4
If suspended → breeder_profiles.suspended_until set