# |
Mar 28th 2019, 15:29 |
ricksaccous |
ok |
# |
Mar 28th 2019, 15:29 |
ricksaccous |
hehe |
# |
Mar 28th 2019, 15:29 |
josbeir |
yes |
# |
Mar 28th 2019, 15:29 |
ricksaccous |
i am so behind on field types in dbs |
# |
Mar 28th 2019, 15:29 |
ricksaccous |
oh, does that have json fields? |
# |
Mar 28th 2019, 15:29 |
neon1024 |
Maria |
# |
Mar 28th 2019, 15:29 |
ricksaccous |
@neon1024 do you use postegres? |
# |
Mar 28th 2019, 15:29 |
josbeir |
1 addresses table, put common fields in there as field, put the rest in a json field |
# |
Mar 28th 2019, 15:29 |
neon1024 |
You could also write an address data type and have the address json marshall into objects |
# |
Mar 28th 2019, 15:29 |
cnizzardini |
So I would just use the 2 or 3 char ISO code for storing country since it fits in a char |
# |
Mar 28th 2019, 15:28 |
cnizzardini |
But I am not a fan of high normalization |
# |
Mar 28th 2019, 15:28 |
cnizzardini |
You could normalize the country_id |
# |
Mar 28th 2019, 15:28 |
neon1024 |
Otherwise I’d have gone for a single table with generic columns |
# |
Mar 28th 2019, 15:28 |
cnizzardini |
Honestly I would just do a single address table for all |
# |
Mar 28th 2019, 15:28 |
neon1024 |
Depending on what I needed to do with the addresses, honestly my first thought would be a json column |
# |
Mar 28th 2019, 15:27 |
cnizzardini |
I would not have done that personally |
# |
Mar 28th 2019, 15:27 |
ricksaccous |
yeah |
# |
Mar 28th 2019, 15:27 |
cnizzardini |
Did you split non-US addresses into their own? |
# |
Mar 28th 2019, 15:27 |
cnizzardini |
What is UsAddress and OtherAddress? |
# |
Mar 28th 2019, 15:26 |
josbeir |
addresses are messy :' |
# |
Mar 28th 2019, 15:26 |
ricksaccous |
next time i'll probably just do that, heh |
# |
Mar 28th 2019, 15:26 |
ricksaccous |
with a decent amount of nullable fields |
# |
Mar 28th 2019, 15:25 |
ricksaccous |
i wanted to do one big addresses table and just plop address type in there initially |
# |
Mar 28th 2019, 15:22 |
cnizzardini |
awesome i did not know about setup plugin, im adding this maintenance mode |
# |
Mar 28th 2019, 15:22 |
ricksaccous |
just for future reference at this point because it would take a decent amount of refactoring |
# |
Mar 28th 2019, 15:21 |
ricksaccous |
how would you have done it? |
# |
Mar 28th 2019, 15:21 |
neon1024 |
:thinking_face: I wouldn’t have normalized the addresses by country |
# |
Mar 28th 2019, 15:21 |
ricksaccous |
hehehe, yeah, although honestly seems that postal code is shared across all address types so i could move it to addresses table |
# |
Mar 28th 2019, 15:20 |
neon1024 |
Wait, you’re storing the zip code in the address types table? |
# |
Mar 28th 2019, 15:20 |
ricksaccous |
Users -> Addresses -> [UsAddress, OtherAddress, etc] |
# |
Mar 28th 2019, 15:20 |
ricksaccous |
so |
# |
Mar 28th 2019, 15:20 |
ricksaccous |
well they are filtering the users model essentially |
# |
Mar 28th 2019, 15:20 |
ricksaccous |
so |
# |
Mar 28th 2019, 15:19 |
ricksaccous |
filter the model* |
# |
Mar 28th 2019, 15:19 |
ricksaccous |
so if any of them have a zip code like the one being searched for i want to filter the users based on that |
# |
Mar 28th 2019, 15:19 |
ricksaccous |
the address type tables have the zip code |
# |
Mar 28th 2019, 15:18 |
ricksaccous |
I think I'll keep it simple for now and do one matching but basically users can filter results based on zip code, and the model i have is related to addresses table which in turn is related to three different address types |
# |
Mar 28th 2019, 15:17 |
neon1024 |
What is it you’re actually trying to achieve? |
# |
Mar 28th 2019, 15:17 |
neon1024 |
@ricksaccous https://github.com/cakephp/cakephp/blob/master/src/Database/Query.php#L1842-L1882 |
# |
Mar 28th 2019, 15:12 |
neon1024 |
I’m sure you can interrogate the query object |
# |
Mar 28th 2019, 15:12 |
ricksaccous |
ok |