# |
Mar 29th 2019, 12:38 |
admad |
@val you can't change db of active connection. you need to change and reconnect so practically same as making new connection |
# |
Mar 29th 2019, 12:38 |
spriz |
It’s from 2015 but I think it’s still applicable with minor adjustments |
# |
Mar 29th 2019, 12:37 |
spriz |
I’d check http://mark-story.com/posts/view/using-cakephp-and-a-horizontally-sharded-database :slightly_smiling_face: |
# |
Mar 29th 2019, 12:37 |
val |
@spriz what simpler solution? @admad ok, how the connection can switch from one schema from another without creating a new connection? |
# |
Mar 29th 2019, 12:35 |
spriz |
I’ve previously just used multiple database connections though |
# |
Mar 29th 2019, 12:35 |
admad |
database name name is set in connection, models/tables know nothign abotu it |
# |
Mar 29th 2019, 12:35 |
spriz |
There’s been quite a lot of talk about multi tenancy applications like that in cakephp, I think there is a simpler solution to that @val :slightly_smiling_face: |
# |
Mar 29th 2019, 12:35 |
val |
@admad by scheama I mean a database with tables |
# |
Mar 29th 2019, 12:34 |
admad |
@val you by schema you mean table? |
# |
Mar 29th 2019, 12:34 |
val |
@spriz more or less the same environment. Because there are thousands of customers. @admad nope. We use MySQL. |
# |
Mar 29th 2019, 12:33 |
spriz |
And why is it too expensive to create a new connection? |
# |
Mar 29th 2019, 12:33 |
admad |
@val are you referring to postgres schema? |
# |
Mar 29th 2019, 12:33 |
spriz |
Hmm, and it’s the same app environment for all customers? |
# |
Mar 29th 2019, 12:28 |
val |
I wonder how would it be possible to set the schema name before the model is created. Logically, model factory seems to be a good place for that. |
# |
Mar 29th 2019, 12:24 |
val |
> Hi, is there a quick way in cake 3.x to switch to a different database schema without creating a new database connection? The use case is when each customer has its own database, the schemas are identical for each customer and cake app needs to retrieve data from multiple databases (from identical table of the customer database). Or simply to switch from one customer database to another. Creating new connections is too expensive. |
# |
Mar 29th 2019, 12:22 |
spriz |
What are you trying to accomplish @val? |
# |
Mar 29th 2019, 12:22 |
slackebot2 |
!xy problem |
# |
Mar 29th 2019, 12:22 |
slackebot2 |
Command sent from Slack by spriz: |
# |
Mar 29th 2019, 12:22 |
spriz |
I believe so, not completely sure though. This could sound like a XY problem though |
# |
Mar 29th 2019, 12:21 |
val |
IndexRegistry is a factory? |
# |
Mar 29th 2019, 12:20 |
spriz |
that’s a cakephp elasticsearch integration using these model factories |
# |
Mar 29th 2019, 12:20 |
spriz |
specifically https://github.com/cakephp/elastic-search/blob/b9d434c0fce6250a8acb616f7be00d599e276803/src/IndexRegistry.php AFAIK :slightly_smiling_face: |
# |
Mar 29th 2019, 12:20 |
val |
@spriz what's that? |
# |
Mar 29th 2019, 12:19 |
spriz |
@val I’d imagine it could be https://github.com/cakephp/elastic-search/tree/master/src ? |
# |
Mar 29th 2019, 12:18 |
val |
The cookbook briefly mentions the model factory - https://book.cakephp.org/3.0/en/controllers.html#loading-additional-models. Could anyone provide an example or a better explanation how to build my own model factory? |
# |
Mar 29th 2019, 12:15 |
spriz |
People tend to forget that developing software is not really about the initial cost but also the year-to-year maintenance, which often is the same or higher than the cost of initially building it |
# |
Mar 29th 2019, 12:14 |
spriz |
@acosonic as an outsider it really seems like you’re working with someone that do not truly understand the maintenance cost of software :cold_sweat: |
# |
Mar 29th 2019, 10:19 |
acosonic |
Well, now they have decided to make order in backend system, it might be good idea to work on migration later |
# |
Mar 29th 2019, 09:57 |
neon1024 |
I can’t find that one on YouTube, sorry |
# |
Mar 29th 2019, 09:54 |
neon1024 |
There was a good talk about that at Symfony meetup by Cieran McNulty |
# |
Mar 29th 2019, 09:54 |
neon1024 |
Parallel upgrades are a good solution here |
# |
Mar 29th 2019, 09:54 |
neon1024 |
The list isn’t endless. It might be big, but you’re not going to upgrade all those parts at the same time |
# |
Mar 29th 2019, 09:53 |
neon1024 |
https://www.youtube.com/watch?v=DtH__Iz9Mjs |
# |
Mar 29th 2019, 09:52 |
acosonic |
The codebase is massive, and it's mostly financial stuff, products, customers, account plans, coupons, promotions, landing page systems, invoices, re-occuring payments, blah-blah, the list is endless... |
# |
Mar 29th 2019, 09:52 |
neon1024 |
Let me find Mark’s talk where he outlines it all |
# |
Mar 29th 2019, 09:52 |
neon1024 |
Currently yes, but not once 4 is out |
# |
Mar 29th 2019, 09:51 |
acosonic |
So they say, they will be fixing Cake 2 stuff, when something like php upgrades broke it |
# |
Mar 29th 2019, 09:50 |
neon1024 |
So maybe not now, but soon you’ll want to think about leveraging newer code and php 7 |
# |
Mar 29th 2019, 09:49 |
neon1024 |
I would expect Cake 4 to be released before the end of the year |
# |
Mar 29th 2019, 09:49 |
neon1024 |
Do bear in mind that once Cake 4 is released Cake 2 will no longer be supported |
# |
Mar 29th 2019, 09:48 |
acosonic |
@neon1024 nope, just different backend admin theme, and fixing layout |