Singodimejo
DTDrizzle Team
•Created by Anas Badran on 8/17/2024 in #help
conditional unique constraint
since person to primary is a one-to-one relationship, you should handle it differently to the many-to-many relationship of non primary phone number.
21 replies
DTDrizzle Team
•Created by Anas Badran on 8/17/2024 in #help
conditional unique constraint
then just put the primaryPhone ID as a column on the person table then. so the person to phone table should only hold non primary phone numbers
21 replies
DTDrizzle Team
•Created by Anas Badran on 8/17/2024 in #help
conditional unique constraint
and about the primary phone number?? can two people have the same primary phone number??
21 replies
DTDrizzle Team
•Created by Anas Badran on 8/17/2024 in #help
conditional unique constraint
I'm trying to understand your business logic for the table relations.
one person can have many phone numbers but only one primary phone number
one phone number can belong to multiple people.
does this sound correct? and also, can two people have the same primary phone number?
21 replies
DTDrizzle Team
•Created by Anas Badran on 8/17/2024 in #help
conditional unique constraint
I meant like can two users share a primary phone number?
21 replies
DTDrizzle Team
•Created by Anas Badran on 8/17/2024 in #help
conditional unique constraint
huh
21 replies
DTDrizzle Team
•Created by Anas Badran on 8/17/2024 in #help
conditional unique constraint
but they can't share primary number, right?
21 replies
DTDrizzle Team
•Created by Anas Badran on 8/17/2024 in #help
conditional unique constraint
oh
21 replies
DTDrizzle Team
•Created by Anas Badran on 8/17/2024 in #help
conditional unique constraint
Maybe have two relation tables? one for person to primary which has a unique constraint on the personID and the person to nonprimary without that constraint on the personID but on both personID and phoneID column?
if you do it this way you'd need to do a join statement with an extra isPrimary column.
21 replies
DTDrizzle Team
•Created by Anas Badran on 8/17/2024 in #help
conditional unique constraint
though that still does not restrict it to being able to having multiple primary phone number
21 replies
DTDrizzle Team
•Created by Anas Badran on 8/17/2024 in #help
conditional unique constraint
why not just add personID to phone table? seems like person to phone should be a one-to-many relationship. Then you can just add isPrimary column to the phone table.
21 replies
DTDrizzle Team
•Created by Anas Badran on 8/17/2024 in #help
conditional unique constraint
I am not sure if that's possible to restrict on the database. unless you create a separate relation table for person to primary phone and make userID unique and the phone ID not null.
21 replies
DTDrizzle Team
•Created by Singodimejo on 8/16/2024 in #help
problems with config file dialect for PostgreSQL
cool, thanks for the advice, will give that a try later
18 replies
DTDrizzle Team
•Created by Singodimejo on 8/16/2024 in #help
problems with config file dialect for PostgreSQL
I’d give it a try on monday and keep y’all updated. If y’all have any other ideas I can try, let me know!
18 replies
DTDrizzle Team
•Created by Singodimejo on 8/16/2024 in #help
problems with config file dialect for PostgreSQL
I don’t have access to the code rn since it’s on my work laptop that I left in my office, but I don’t see how that would help since it’ll be a similar result to my current set up, no?
18 replies
DTDrizzle Team
•Created by Singodimejo on 8/16/2024 in #help
problems with config file dialect for PostgreSQL
Then the Config type shows me an error since PGUSER would be string | null
18 replies
DTDrizzle Team
•Created by Singodimejo on 8/16/2024 in #help
problems with config file dialect for PostgreSQL
I even made sure by putting a console log in the config file so whenever I run a command it would spit out the variables used and they all seem correct
18 replies
DTDrizzle Team
•Created by Singodimejo on 8/16/2024 in #help
problems with config file dialect for PostgreSQL
You’d think so, but if I use the url key for the dbCredential and make the url string using template strings to leverage the environment variables it works just fine.
18 replies
DTDrizzle Team
•Created by Singodimejo on 8/16/2024 in #help
problems with config file dialect for PostgreSQL
I’m using sveltekit
18 replies