Skip to content

Commit 61c867b

Browse files
committed
Add info for add new profile field
1 parent 87de30d commit 61c867b

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

docs/development.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
11
# Documentation for development
22

33
> [!WARNING]
4-
> TODO: This document is a work in progress. Please help us improve it by contributing!
4+
> TODO: This document is a work in progress. Please help us improve it!
55
66
See those other useful documents as well:
77
- [knowledge.md](knowledge.md) for high-level architecture and design decisions.
88
- [README.md](../backend/api/README.md) for the backend API
99
- [README.md](../backend/email/README.md) for the email routines and how to set up a local server for quick email rendering
1010
- [README.md](../web/README.md) for the frontend / web server
1111

12-
### Adding a new profile variable
12+
### Adding a new profile field
1313

14-
To add a profile variable (personality type, etc.), make modifications here:
15-
* ...
14+
A profile field is any variable associated with a user profile, such as age, politics, diet, etc. You may want to add a new profile field if it helps people find better matches.
1615

17-
You will likely need to update the `profiles` table of the database. Set up an SQL migration file that updates the table, as in [migrations](../backend/supabase/migrations), and run it in the same vein as [migrate.sh](../scripts/migrate.sh).
16+
To do so, you can add code in a similar way as in [this commit](https://github.com/CompassConnections/Compass/commit/b94cdba5af377b06c31cebb97c0a772ad6324690) for the `diet` field.
1817

19-
Sync the database types from supabase to the local files (which assist Typescript in typing):
18+
[//]: # (If you also want people to filter by that profile field, you'll also need to add it to the search filters, as done in [this commit](https://github.com/CompassConnections/Compass/commit/591798e98c51144fe257e28cf463707be748c2aa) for the education level. )
19+
20+
Note that you will also need to add a column to the `profiles` table in the dev database before running the code; you can do so via this SQL command (change the type if not `TEXT`):
21+
```sql
22+
ALTER TABLE profiles ADD COLUMN some_new_profile_field TEXT;
23+
```
24+
25+
Store it in `add_some_some_profile_field.sql` in the [migrations](../backend/supabase/migrations) folder and run [migrate.sh](../scripts/migrate.sh) from the root folder:
2026
```bash
27+
./scripts/migrate.sh backend/supabase/migrations/add_some_new_profile_field.sql
28+
```
2129

22-
yarn regen-types
30+
Then sync the database types from supabase to the local files (which assist Typescript in typing):
31+
```bash
32+
yarn regen-types dev
2333
```
2434

35+
That's it!
36+
2537
### Cover with tests
2638

2739
Best Practices

0 commit comments

Comments
 (0)