Skip to content

Conversation

@erikogan
Copy link
Contributor

This branch allows LHM to migrate tables with (outbound) foreign key constraints by renaming the constraints on the destination table.

@ghost
Copy link

ghost commented Jun 18, 2013

Thanks a lot for looking into this! I'm packed with stuff today, will have a look at this tomorrow or Thursday.

@erikogan
Copy link
Contributor Author

I just realized that the mechanism to generate the constraint names is even less ideal than I thought. It will probably fail if you try to run LHM on a table twice. I’m going to take a stab at improving it this morning, but I have a lot going on.

@erikogan
Copy link
Contributor Author

The newest commit is a bit more invasive than I’d like, but it solves the problem much more robustly. And sets things up to work on fixing inbound foreign keys as well.

erikogan added 5 commits July 20, 2013 09:54
Brute force the new constraint names by offsetting the (optional) index in the name by the total number of keys.
Reads all of the constraint names and makes sure to choose one that does not clash.
Do not assume it is present.
@erikogan
Copy link
Contributor Author

I just rebased everything off the most recent upstream master and fixed the last of the failing builds. I think this one is good to go.

@ssoroka-se
Copy link

tested and works great. +1 for merge. Now we just need self-referential constraints and inbound constraint support.

@pomier
Copy link

pomier commented Oct 24, 2014

I tested this, but it didn't work on tables having more than one foreign key.
I had two foreign keys, table_ibfk_1 and table_ibfk_2, and in the new table these two FK got the same name, table_ibfk_3.

@ssoroka-se
Copy link

I don't believe I ran in to that problem, even with multiple FKs

@arthurnn
Copy link
Contributor

Thanks for the PR, #77 is a more complete solution, so I will try to get that one merged in.

thanks again.

@arthurnn arthurnn closed this Mar 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants