Skip to content

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants