Open mindspin311 opened 11 years ago
Think this fixes it (Note the lines might be off due to alot of local mods in this file). Wasn't sure if you had a better way to handle this (haven't commit anything), but it seems to solve the optional database.tablename format.
@@ -1185,7 +1213,12 @@ class Modyllic_Parser {
$this->get_reserved();
$key->weak = true;
}
+
+ // Handle the '{database}.{table}' format
$key->references['table'] = $this->get_ident();
+ if ($this->maybe('.')) {
+ $key->references['table'] .= '.' . $this->get_ident();
+ }
Fixed in my branch, but couldn't commit to yours. Says I don't have permission. I can just commit to mine and you can merge in changes from that one if you want my fixes.
Make a branch in your fork with the change, then a pull request for it. Pull requests are located in the icon just below the issues icon. Alternatively, when you're viewing your fork it should show you the recently created branch with a pull request button.
We never (almost) never commit to OnlineBuddies/Modyllic– with the exception of releases, it's a merge-only branch. Merges are never done by the person who made the change, they're always done via pull request and someone else reviews the changes and accepts them or asks for changes.
My suspicion is that this patch will still produce errors, just not parse errors. I would expect it to produce an error of this kind:
$constraintname references the table $tablename which does not exist.
These show up at the top of dumps and diffs and will halt migrations unless you --force
them.
Modyllic is distinctly lacking in cross-schema support. Ideally you'd be able to have it load multiple schema and thus it'd be able to validate this sort of cross schema link. That being said though, it'd require not insubstantial refactoring.
One interim measure might be to add a database key to Modyllic_Schema_Index_Foreign and populate that (rather then cramming both into the table name) and then skip validation if that's set (or, perhaps, if it differs from $schema->name).
Seems to be an issue referencing a table in a different db.