From ced1e36233706ae084ee18fc77dbd1fdc3586f3a Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Mon, 27 Apr 2026 21:30:37 +0530 Subject: [PATCH 01/15] Create DB_CONTRACT.md --- docs/DB_CONTRACT.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docs/DB_CONTRACT.md diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md new file mode 100644 index 0000000..aee5ed1 --- /dev/null +++ b/docs/DB_CONTRACT.md @@ -0,0 +1,17 @@ +# ChMS - Database Contract + +This markdown lists all core database tables and their columns along with its types and constraints for the Church Management System (ChMS). + +## 1. users (Authentication) + +| Column | Type | Notes / Constraints | +| ------------- | --------- | ------------------------- | +| id | UUID | Primary Key | +| name | String | User's full name | +| email | String | Unique, indexed | +| password | String | Hashed | +| has_onboarded | Boolean | Default: false | +| role | Enum | member, admin, superadmin | +| is_active | Boolean | Default: true | +| created_at | Timestamp | | +| updated_at | Timestamp | | From 48874ad5ce499c35faadd3881ca8f4dbee2657f7 Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Mon, 27 Apr 2026 21:31:37 +0530 Subject: [PATCH 02/15] Add Families Table --- docs/DB_CONTRACT.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index aee5ed1..b32362d 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -15,3 +15,12 @@ This markdown lists all core database tables and their columns along with its ty | is_active | Boolean | Default: true | | created_at | Timestamp | | | updated_at | Timestamp | | + +## 2. families (Central Unit for Families) + +| Column | Type | Notes / Constraints | +| ----------- | ------ | ---------------------- | +| id | UUID | Primary Key | +| user_id | UUID | Foreign Key to users | +| family_name | String | e.g., "Livingston" | +| home_phone | String | Primary contact number | From 6885a6bc9d16636486d338ac513f11ec77b3c359 Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Mon, 27 Apr 2026 21:58:43 +0530 Subject: [PATCH 03/15] Families Update More Columns --- docs/DB_CONTRACT.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index b32362d..fa29b60 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -18,9 +18,15 @@ This markdown lists all core database tables and their columns along with its ty ## 2. families (Central Unit for Families) -| Column | Type | Notes / Constraints | -| ----------- | ------ | ---------------------- | -| id | UUID | Primary Key | -| user_id | UUID | Foreign Key to users | -| family_name | String | e.g., "Livingston" | -| home_phone | String | Primary contact number | +| Column | Type | Notes / Constraints | +| ----------- | --------- | --------------------------------------- | +| id | UUID | Primary Key | +| user_id | UUID | Foreign Key to users | +| family_name | String | e.g., "Livingston" | +| home_phone | String | Primary contact number | +| address | Text | Full address (street, city, state, pin) | +| annual_dues | Decimal | e.g., 1200.00 (nullable) | +| status | Enum | active, inactive, moved | +| notes | Text | Admin note (only visible to admin) | +| created_at | Timestamp | | +| updated_at | Timestamp | | From 59bc82001d8de4c6932d4bdfed08dc7224ed7884 Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Tue, 28 Apr 2026 20:46:32 +0530 Subject: [PATCH 04/15] Family Members Table --- docs/DB_CONTRACT.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index fa29b60..7acf1e3 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -30,3 +30,16 @@ This markdown lists all core database tables and their columns along with its ty | notes | Text | Admin note (only visible to admin) | | created_at | Timestamp | | | updated_at | Timestamp | | + +## 3. family_members (Links members to families) + +| Column | Type | Notes / Constraints | +| --------- | ------ | ----------------------- | +| id | UUID | Primary Key | +| user_id | UUID | Foreign Key to users | +| family_id | UUID | Foreign Key to families | +| name | String | User's full name | +| email | String | Unique, indexed | +| phone | String | Primary contact number | +| gender | Enum | male, female | +| dob | Date | Date of Birth | From 7ae5af64c75865feed774c21e490d03ca07316c1 Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Tue, 28 Apr 2026 21:19:22 +0530 Subject: [PATCH 05/15] Update DB_CONTRACT.md --- docs/DB_CONTRACT.md | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index 7acf1e3..ba86c3b 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -33,13 +33,20 @@ This markdown lists all core database tables and their columns along with its ty ## 3. family_members (Links members to families) -| Column | Type | Notes / Constraints | -| --------- | ------ | ----------------------- | -| id | UUID | Primary Key | -| user_id | UUID | Foreign Key to users | -| family_id | UUID | Foreign Key to families | -| name | String | User's full name | -| email | String | Unique, indexed | -| phone | String | Primary contact number | -| gender | Enum | male, female | -| dob | Date | Date of Birth | +| Column | Type | Notes / Constraints | +| -------------- | --------- | -------------------------- | +| id | UUID | Primary Key | +| user_id | UUID | Foreign Key to users | +| family_id | UUID | Foreign Key to families | +| name | String | User's full name | +| email | String | Unique, indexed | +| phone | String | Primary contact number | +| gender | Enum | male, female | +| dob | Date | Date of Birth | +| relationship | Enum | head, spouse, child, other | +| marital_status | Enum | single, married | +| married_to | UUID | Id of person married to | +| wedding_day | UUID | Id of person married to | +| is_primary | Boolean | True for primary contact | +| created_at | Timestamp | | +| updated_at | Timestamp | | From 9b48490ed645c5a7ffc30f9047d11a78b31671a1 Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Tue, 28 Apr 2026 22:08:52 +0530 Subject: [PATCH 06/15] Family Relationship Table Init --- docs/DB_CONTRACT.md | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index ba86c3b..11c4cf4 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -33,20 +33,21 @@ This markdown lists all core database tables and their columns along with its ty ## 3. family_members (Links members to families) -| Column | Type | Notes / Constraints | -| -------------- | --------- | -------------------------- | -| id | UUID | Primary Key | -| user_id | UUID | Foreign Key to users | -| family_id | UUID | Foreign Key to families | -| name | String | User's full name | -| email | String | Unique, indexed | -| phone | String | Primary contact number | -| gender | Enum | male, female | -| dob | Date | Date of Birth | -| relationship | Enum | head, spouse, child, other | -| marital_status | Enum | single, married | -| married_to | UUID | Id of person married to | -| wedding_day | UUID | Id of person married to | -| is_primary | Boolean | True for primary contact | -| created_at | Timestamp | | -| updated_at | Timestamp | | +| Column | Type | Notes / Constraints | +| -------------- | --------- | ------------------------ | +| id | UUID | Primary Key | +| user_id | UUID | Foreign Key to users | +| family_id | UUID | Foreign Key to families | +| name | String | User's full name | +| email | String | Unique, indexed | +| phone | String | Primary contact number | +| gender | Enum | male, female | +| dob | Date | Date of Birth | +| marital_status | Enum | single, married | +| married_to | UUID | Id of person married to | +| wedding_day | UUID | Id of person married to | +| is_primary | Boolean | True for primary contact | +| created_at | Timestamp | | +| updated_at | Timestamp | | + +## 4. family_relationship (Links members to members) From 606df8a891ad144d1798f608fbda51300f43a15b Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Wed, 29 Apr 2026 19:29:13 +0530 Subject: [PATCH 07/15] Updated family_relationship and family_members Tables --- docs/DB_CONTRACT.md | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index 11c4cf4..6491b2b 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -21,7 +21,7 @@ This markdown lists all core database tables and their columns along with its ty | Column | Type | Notes / Constraints | | ----------- | --------- | --------------------------------------- | | id | UUID | Primary Key | -| user_id | UUID | Foreign Key to users | +| user_id | UUID | Foreign Key -> users | | family_name | String | e.g., "Livingston" | | home_phone | String | Primary contact number | | address | Text | Full address (street, city, state, pin) | @@ -33,21 +33,31 @@ This markdown lists all core database tables and their columns along with its ty ## 3. family_members (Links members to families) -| Column | Type | Notes / Constraints | -| -------------- | --------- | ------------------------ | -| id | UUID | Primary Key | -| user_id | UUID | Foreign Key to users | -| family_id | UUID | Foreign Key to families | -| name | String | User's full name | -| email | String | Unique, indexed | -| phone | String | Primary contact number | -| gender | Enum | male, female | -| dob | Date | Date of Birth | -| marital_status | Enum | single, married | -| married_to | UUID | Id of person married to | -| wedding_day | UUID | Id of person married to | -| is_primary | Boolean | True for primary contact | -| created_at | Timestamp | | -| updated_at | Timestamp | | +| Column | Type | Notes / Constraints | +| ---------- | --------- | ------------------------ | +| id | UUID | Primary Key | +| user_id | UUID | Foreign Key -> users | +| family_id | UUID | Foreign Key -> families | +| name | String | User's full name | +| email | String | Unique, indexed | +| phone | String | Primary contact number | +| gender | Enum | male, female | +| dob | Date | Date of Birth | +| is_primary | Boolean | True for primary contact | +| created_at | Timestamp | | +| updated_at | Timestamp | | ## 4. family_relationship (Links members to members) + +| Column | Type | Notes / Constraints | +| ----------------- | --------- | ---------------------------------------- | +| id | UUID | PK | +| family_id | UUID | FK -> families | +| member_id | UUID | FK -> family_members | +| related_member_id | UUID | FK -> family_members | +| relationship_type | Enum | spouse, parent, child, sibling, guardian | +| start_date | Date | marriage date, guardianship start | +| end_date | Date | divorce, ended relation | +| is_active | Boolean | current relationship | +| created_at | Timestamp | +| updated_at | Timestamp | From 8acd1dbd8564db888754f7ecd178278126819564 Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Wed, 29 Apr 2026 19:36:23 +0530 Subject: [PATCH 08/15] Removed family_name from families Table --- docs/DB_CONTRACT.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index 6491b2b..fdf8ba6 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -22,7 +22,6 @@ This markdown lists all core database tables and their columns along with its ty | ----------- | --------- | --------------------------------------- | | id | UUID | Primary Key | | user_id | UUID | Foreign Key -> users | -| family_name | String | e.g., "Livingston" | | home_phone | String | Primary contact number | | address | Text | Full address (street, city, state, pin) | | annual_dues | Decimal | e.g., 1200.00 (nullable) | From b139f57b6ad560404e5d72ed659a8cfe7fb70d41 Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Wed, 29 Apr 2026 20:21:04 +0530 Subject: [PATCH 09/15] Added primary_phone and secondary_phone --- docs/DB_CONTRACT.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index fdf8ba6..bab63dd 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -32,19 +32,20 @@ This markdown lists all core database tables and their columns along with its ty ## 3. family_members (Links members to families) -| Column | Type | Notes / Constraints | -| ---------- | --------- | ------------------------ | -| id | UUID | Primary Key | -| user_id | UUID | Foreign Key -> users | -| family_id | UUID | Foreign Key -> families | -| name | String | User's full name | -| email | String | Unique, indexed | -| phone | String | Primary contact number | -| gender | Enum | male, female | -| dob | Date | Date of Birth | -| is_primary | Boolean | True for primary contact | -| created_at | Timestamp | | -| updated_at | Timestamp | | +| Column | Type | Notes / Constraints | +| --------------- | --------- | ------------------------ | +| id | UUID | Primary Key | +| user_id | UUID | Foreign Key -> users | +| family_id | UUID | Foreign Key -> families | +| name | String | User's full name | +| email | String | Unique, indexed | +| primary_phone | String | Primary contact number | +| secondary_phone | String | Primary contact number | +| gender | Enum | male, female | +| dob | Date | Date of Birth | +| is_primary | Boolean | True for primary contact | +| created_at | Timestamp | | +| updated_at | Timestamp | | ## 4. family_relationship (Links members to members) @@ -58,5 +59,5 @@ This markdown lists all core database tables and their columns along with its ty | start_date | Date | marriage date, guardianship start | | end_date | Date | divorce, ended relation | | is_active | Boolean | current relationship | -| created_at | Timestamp | -| updated_at | Timestamp | +| created_at | Timestamp | | +| updated_at | Timestamp | | From 33e2b625be27d9644ec23741371d745305ce3aea Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Fri, 1 May 2026 20:52:52 +0530 Subject: [PATCH 10/15] Added Is_Alive Column --- docs/DB_CONTRACT.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index bab63dd..3eccee0 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -32,20 +32,21 @@ This markdown lists all core database tables and their columns along with its ty ## 3. family_members (Links members to families) -| Column | Type | Notes / Constraints | -| --------------- | --------- | ------------------------ | -| id | UUID | Primary Key | -| user_id | UUID | Foreign Key -> users | -| family_id | UUID | Foreign Key -> families | -| name | String | User's full name | -| email | String | Unique, indexed | -| primary_phone | String | Primary contact number | -| secondary_phone | String | Primary contact number | -| gender | Enum | male, female | -| dob | Date | Date of Birth | -| is_primary | Boolean | True for primary contact | -| created_at | Timestamp | | -| updated_at | Timestamp | | +| Column | Type | Notes / Constraints | +| --------------- | --------- | ----------------------- | +| id | UUID | Primary Key | +| user_id | UUID | Foreign Key -> users | +| family_id | UUID | Foreign Key -> families | +| name | String | User's full name | +| email | String | Unique, indexed | +| primary_phone | String | Primary contact number | +| secondary_phone | String | Primary contact number | +| gender | Enum | male, female | +| dob | Date | Date of Birth | +| is_primary | Boolean | | +| is_alive | Boolean | Default true | +| created_at | Timestamp | | +| updated_at | Timestamp | | ## 4. family_relationship (Links members to members) @@ -58,6 +59,5 @@ This markdown lists all core database tables and their columns along with its ty | relationship_type | Enum | spouse, parent, child, sibling, guardian | | start_date | Date | marriage date, guardianship start | | end_date | Date | divorce, ended relation | -| is_active | Boolean | current relationship | | created_at | Timestamp | | | updated_at | Timestamp | | From 7c5ecc28cc6baef3969df436bb839f421da0eb09 Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Sat, 2 May 2026 10:34:05 +0530 Subject: [PATCH 11/15] Removed annual_dues from Families Table --- docs/DB_CONTRACT.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index 3eccee0..d745fdd 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -18,17 +18,16 @@ This markdown lists all core database tables and their columns along with its ty ## 2. families (Central Unit for Families) -| Column | Type | Notes / Constraints | -| ----------- | --------- | --------------------------------------- | -| id | UUID | Primary Key | -| user_id | UUID | Foreign Key -> users | -| home_phone | String | Primary contact number | -| address | Text | Full address (street, city, state, pin) | -| annual_dues | Decimal | e.g., 1200.00 (nullable) | -| status | Enum | active, inactive, moved | -| notes | Text | Admin note (only visible to admin) | -| created_at | Timestamp | | -| updated_at | Timestamp | | +| Column | Type | Notes / Constraints | +| ---------- | --------- | --------------------------------------- | +| id | UUID | Primary Key | +| user_id | UUID | Foreign Key -> users | +| home_phone | String | Primary contact number | +| address | Text | Full address (street, city, state, pin) | +| status | Enum | active, inactive, moved | +| notes | Text | Admin note (only visible to admin) | +| created_at | Timestamp | | +| updated_at | Timestamp | | ## 3. family_members (Links members to families) From b0e25f261ecccf9f81ece8da9133b78f354925fd Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Sat, 2 May 2026 20:39:48 +0530 Subject: [PATCH 12/15] New Table - auction_dues --- docs/DB_CONTRACT.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index d745fdd..a20ad72 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -16,7 +16,7 @@ This markdown lists all core database tables and their columns along with its ty | created_at | Timestamp | | | updated_at | Timestamp | | -## 2. families (Central Unit for Families) +## 2. families (Central Unit for families) | Column | Type | Notes / Constraints | | ---------- | --------- | --------------------------------------- | @@ -47,7 +47,7 @@ This markdown lists all core database tables and their columns along with its ty | created_at | Timestamp | | | updated_at | Timestamp | | -## 4. family_relationship (Links members to members) +## 4. family_relationship (Links member to member relationships) | Column | Type | Notes / Constraints | | ----------------- | --------- | ---------------------------------------- | @@ -56,7 +56,19 @@ This markdown lists all core database tables and their columns along with its ty | member_id | UUID | FK -> family_members | | related_member_id | UUID | FK -> family_members | | relationship_type | Enum | spouse, parent, child, sibling, guardian | -| start_date | Date | marriage date, guardianship start | -| end_date | Date | divorce, ended relation | +| started_on | Date | marriage date, guardianship start | +| ended_on | Date | divorce, ended relation | | created_at | Timestamp | | | updated_at | Timestamp | | + +## 5. auction_dues (Links families to their dues) + +| Column | Type | Notes / Constraints | +| --------------- | --------- | ------------------- | +| id | UUID | PK | +| family_id | UUID | FK -> families | +| auction_held_on | Date | Date of auction | +| due_amount | Decimal | Amount to be paid | +| due_on | Date | Due date | +| created_at | Timestamp | | +| updated_at | Timestamp | | From 40929406da3e817efdeef750fe4ced96072417b8 Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Mon, 4 May 2026 20:57:41 +0530 Subject: [PATCH 13/15] Update docs/DB_CONTRACT.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- docs/DB_CONTRACT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index a20ad72..59773c4 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -39,7 +39,7 @@ This markdown lists all core database tables and their columns along with its ty | name | String | User's full name | | email | String | Unique, indexed | | primary_phone | String | Primary contact number | -| secondary_phone | String | Primary contact number | +| secondary_phone | String | Secondary contact number | | gender | Enum | male, female | | dob | Date | Date of Birth | | is_primary | Boolean | | From 584fabefc65e4af31b30e65a4ac48c74489076d0 Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Wed, 6 May 2026 20:55:55 +0530 Subject: [PATCH 14/15] Split up Address --- docs/DB_CONTRACT.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index a20ad72..29cb557 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -18,16 +18,19 @@ This markdown lists all core database tables and their columns along with its ty ## 2. families (Central Unit for families) -| Column | Type | Notes / Constraints | -| ---------- | --------- | --------------------------------------- | -| id | UUID | Primary Key | -| user_id | UUID | Foreign Key -> users | -| home_phone | String | Primary contact number | -| address | Text | Full address (street, city, state, pin) | -| status | Enum | active, inactive, moved | -| notes | Text | Admin note (only visible to admin) | -| created_at | Timestamp | | -| updated_at | Timestamp | | +| Column | Type | Notes / Constraints | +| -------------- | --------- | ---------------------------------- | +| id | UUID | Primary Key | +| user_id | UUID | Foreign Key -> users | +| primary_phone | String | Primary contact number | +| address_line_1 | Text | House number & street address | +| address_line_2 | Text | Apt, Floor | +| city | Text | City or Town name | +| pin_code | Int | Area pin code | +| status | Enum | active, inactive, moved | +| notes | Text | Admin note (only visible to admin) | +| created_at | Timestamp | | +| updated_at | Timestamp | | ## 3. family_members (Links members to families) From 081272908dd6c26809117ac1075ff2ee671814cf Mon Sep 17 00:00:00 2001 From: Samuel Livingston <164835921+JinxSeven@users.noreply.github.com> Date: Wed, 6 May 2026 21:58:48 +0530 Subject: [PATCH 15/15] Better Column Names --- docs/DB_CONTRACT.md | 56 ++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/DB_CONTRACT.md b/docs/DB_CONTRACT.md index db8d926..151f339 100644 --- a/docs/DB_CONTRACT.md +++ b/docs/DB_CONTRACT.md @@ -6,7 +6,7 @@ This markdown lists all core database tables and their columns along with its ty | Column | Type | Notes / Constraints | | ------------- | --------- | ------------------------- | -| id | UUID | Primary Key | +| id | UUID | PK | | name | String | User's full name | | email | String | Unique, indexed | | password | String | Hashed | @@ -18,37 +18,37 @@ This markdown lists all core database tables and their columns along with its ty ## 2. families (Central Unit for families) -| Column | Type | Notes / Constraints | -| -------------- | --------- | ---------------------------------- | -| id | UUID | Primary Key | -| user_id | UUID | Foreign Key -> users | -| primary_phone | String | Primary contact number | -| address_line_1 | Text | House number & street address | -| address_line_2 | Text | Apt, Floor | -| city | Text | City or Town name | -| pin_code | Int | Area pin code | -| status | Enum | active, inactive, moved | -| notes | Text | Admin note (only visible to admin) | -| created_at | Timestamp | | -| updated_at | Timestamp | | +| Column | Type | Notes / Constraints | +| ------------- | --------- | ---------------------------------- | +| id | UUID | PK | +| user_id | UUID | FK -> users | +| primary_phone | String | Primary contact number | +| address | Text | House number & street address | +| address_info | Text | Apt, building, floor - nullable | +| city | Text | City or Town name | +| pin_code | Int | Area pin code | +| status | Enum | active, inactive, moved | +| family_notes | Text | Admin note (only visible to admin) | +| created_at | Timestamp | | +| updated_at | Timestamp | | ## 3. family_members (Links members to families) -| Column | Type | Notes / Constraints | -| --------------- | --------- | ----------------------- | -| id | UUID | Primary Key | -| user_id | UUID | Foreign Key -> users | -| family_id | UUID | Foreign Key -> families | -| name | String | User's full name | -| email | String | Unique, indexed | -| primary_phone | String | Primary contact number | +| Column | Type | Notes / Constraints | +| --------------- | --------- | ------------------------ | +| id | UUID | PK | +| user_id | UUID | FK -> users | +| family_id | UUID | FK -> families | +| name | String | User's full name | +| email | String | Unique, indexed | +| primary_phone | String | Primary contact number | | secondary_phone | String | Secondary contact number | -| gender | Enum | male, female | -| dob | Date | Date of Birth | -| is_primary | Boolean | | -| is_alive | Boolean | Default true | -| created_at | Timestamp | | -| updated_at | Timestamp | | +| gender | Enum | male, female | +| dob | Date | Date of Birth | +| is_primary | Boolean | | +| is_alive | Boolean | Default true | +| created_at | Timestamp | | +| updated_at | Timestamp | | ## 4. family_relationship (Links member to member relationships)