mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-29 12:04:04 -04:00
Add info for add new profile field
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Documentation for development
|
||||
|
||||
> [!WARNING]
|
||||
> TODO: This document is a work in progress. Please help us improve it by contributing!
|
||||
> TODO: This document is a work in progress. Please help us improve it!
|
||||
|
||||
See those other useful documents as well:
|
||||
- [knowledge.md](knowledge.md) for high-level architecture and design decisions.
|
||||
@@ -9,19 +9,31 @@ See those other useful documents as well:
|
||||
- [README.md](../backend/email/README.md) for the email routines and how to set up a local server for quick email rendering
|
||||
- [README.md](../web/README.md) for the frontend / web server
|
||||
|
||||
### Adding a new profile variable
|
||||
### Adding a new profile field
|
||||
|
||||
To add a profile variable (personality type, etc.), make modifications here:
|
||||
* ...
|
||||
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.
|
||||
|
||||
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).
|
||||
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.
|
||||
|
||||
Sync the database types from supabase to the local files (which assist Typescript in typing):
|
||||
```bash
|
||||
[//]: # (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. )
|
||||
|
||||
yarn regen-types
|
||||
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`):
|
||||
```sql
|
||||
ALTER TABLE profiles ADD COLUMN some_new_profile_field TEXT;
|
||||
```
|
||||
|
||||
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:
|
||||
```bash
|
||||
./scripts/migrate.sh backend/supabase/migrations/add_some_new_profile_field.sql
|
||||
```
|
||||
|
||||
Then sync the database types from supabase to the local files (which assist Typescript in typing):
|
||||
```bash
|
||||
yarn regen-types dev
|
||||
```
|
||||
|
||||
That's it!
|
||||
|
||||
### Cover with tests
|
||||
|
||||
Best Practices
|
||||
|
||||
Reference in New Issue
Block a user