Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functionality to use foreignSchema attribute of foreign-key tag… #1674

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

surekap
Copy link

@surekap surekap commented Nov 14, 2020

Reference:
propelorm/Propel#191

The foreignSchema attribute of the foreign-key tag can be used on MySQL to link to other databases
According to the documentation provided at:
http://propelorm.org/documentation/cookbook/using-sql-schemas.html

In databases which support schemas (MySQL), there is no way to add foreign keys across databases.

This PR enables the foreign key relationships by using the database name as the schema name in these cases.

Tested with MySQL

… to create foreign key links to other databases in the same propel project
For other dbs, the <foreign-key foreignSchema="" > attribute can be used to link to databases within the same propel projec
*/
$db = explode(".", $name)[0];
$name = explode(".", $name)[1];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[$db, $name] = explode(..., ..., 2) is the better syntax here.

@dereuromark
Copy link
Contributor

ping @surekap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants