# |
Mar 28th 2019, 16:00 |
ricksaccous |
you still have to create a new connection |
# |
Mar 28th 2019, 16:00 |
ricksaccous |
@val https://book.cakephp.org/3.0/en/orm/database-basics.html#creating-connections-at-runtime |
# |
Mar 28th 2019, 15:56 |
val |
Hi, is there a quick way in cake 3.x to switch to a different database schema without creating a new database connection? |
# |
Mar 28th 2019, 15:37 |
ricksaccous |
and conditional validation is not even that bad |
# |
Mar 28th 2019, 15:37 |
ricksaccous |
the only advantage i get from this is not having to write conditional validation |
# |
Mar 28th 2019, 15:31 |
ricksaccous |
hehe |
# |
Mar 28th 2019, 15:31 |
josbeir |
the guy who invented that... oy |
# |
Mar 28th 2019, 15:31 |
josbeir |
yeah, dont overthink something as lame as addresses |
# |
Mar 28th 2019, 15:31 |
cnizzardini |
<- big fan of meta_data |
# |
Mar 28th 2019, 15:31 |
ricksaccous |
whatever that's called |
# |
Mar 28th 2019, 15:31 |
ricksaccous |
i mean not normalizing, making generic columns |
# |
Mar 28th 2019, 15:31 |
ricksaccous |
this is an unessecary pain |
# |
Mar 28th 2019, 15:31 |
josbeir |
still, if you use it as metadata you wouldn't need those fancy sql functions and mange that stuff by your app |
# |
Mar 28th 2019, 15:31 |
ricksaccous |
honestly after doing it this way i think normalizing in one big table is the way to go |
# |
Mar 28th 2019, 15:30 |
neon1024 |
..amd query support too! :slightly_smiling_face: |
# |
Mar 28th 2019, 15:30 |
josbeir |
mysql 5.7+ has decent json supprot :slightly_smiling_face: |
# |
Mar 28th 2019, 15:30 |
neon1024 |
MySQL 5.7 :slightly_smiling_face: |
# |
Mar 28th 2019, 15:30 |
cnizzardini |
not sure about maria/mysql |
# |
Mar 28th 2019, 15:30 |
cnizzardini |
you can actually query on it there |
# |
Mar 28th 2019, 15:30 |
cnizzardini |
i think PG has better support for json datatype |
# |
Mar 28th 2019, 15:29 |
neon1024 |
Let me check |
# |
Mar 28th 2019, 15:29 |
neon1024 |
Maybe we’re on MySQL, we did change recently |
# |
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? |