[Feature Request] - Support models from alternate database #95

Open
pixelchutes opened this Issue Oct 6, 2016 · 0 comments

Projects

None yet

1 participant

@pixelchutes
Collaborator
pixelchutes commented Oct 6, 2016 edited

It would be great if xPDO allowed working with models from an alternate database.

Today, if you want to work with addPackage() using a model stored in an alternate database, one way to accomplish this is to setup a secondary (or 3rd, or 4th...) xPDO connection.

Example:
https://rtfm.modx.com/extras/revo/cmpgenerator/cmpgenerator.foreign-databases

However, this is an inefficient way of attempting to access a table in an alternate database if it is already on the same server and the current connection's user has proper access permissions.

If there was a way for individual packages to override the database to use, it would open up new opportunities, or at the very least, become more efficient in some scenarios.

The best workaround I have found so far is to leverage a View:

CREATE VIEW local_db.custom_table AS SELECT * FROM foreign_db.custom_table;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment