Conversation
This flag makes migration silently and happily discard any existing foreign keys on migrated table. This is useful for intentional dropping of foreign keys, as gh-ost does not otherwise have support for foreign key migration. At some time in the future gh-ost may support foreign key migration, at which time this flag will be removed
|
Can the docs say something as well about what it does to foreign keys that reference the migrated table? Even if that is repeating itself, that would be a good place to repeat it. Sent from my iPad
|
|
@ggunson thanks for your comment, and I realize we need to refine this and only allow on tables with child-side FK. I don't wish to support any kind of parent-size FK handling at this time; it seems too dangerous to me ( |
parent-side foreign keys cannot be discarded
|
@ggunson a4d566e takes care of parent-side: not supported. Only child-side foreign keys can be discarded. For people who are looking to compleltely eliminate foreign keys on their database, you should begin with child-most tables and move upwards. I don't have an immediate solution to a self-referencing FK table. |
@shlomi-noach I asked if the docs for this could say something about foreign keys referencing the table. So it was a suggestion that you add that to the docs you edited for this PR (e.g., the new flag description), that this doesn't apply to tables who are referenced in FKs from other tables. |
|
@ggunson I was sure I did 😮 but then I realize I wrote this on another couple places. Will add. Anyway, my original comment acknowledged that regardless of the docs, the code was wrong, and that is fixed. Proper error messages will indicate the limitation where someone tried to drop a parent-side foreign key. Docs were supposed to follow suit... |
Storyline: #262
This PR supports dropping of foreign keys from a table. There's nothing special about what
gh-ostdoes to make that happen: it just doesn't do anything to create those foreign keys on the ghost table.gofmt(please avoidgoimports)./build.sh./test.sh