xpdo icon indicating copy to clipboard operation
xpdo copied to clipboard

[Feature Request] - Support models from alternate database

Open pixelchutes opened this issue 7 years ago • 1 comments

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;

pixelchutes avatar Oct 06 '16 21:10 pixelchutes