-
Notifications
You must be signed in to change notification settings - Fork 91
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
::Diff tries to modify old table after table rename for PK col name change #40
Comments
|
https://github.com/dbsrgits/sql-translator/blob/master/lib/SQL/Translator/Diff.pm#L237 is where the madness starts. If a renamed table also has a renamed field then this is the wrong way round since field and possible constraints (pk/unique/...) must be renamed before the table or else you end up with nonsense like: |
|
Time to describe the situation in full... Which looks like: If we want to rename everything then we need to perform the following: So we end up with this: Handling renamed_from for table and field is not so hard but realising that the sequence and index also need renaming to keep things pretty is not so simple. Maybe the best solution would be to implement a batch_table_alter method in ::Producer::PostgreSQL ? |
|
This was fixed by #44, closing. |
I tend to use PK cols which are named after the table e.g. table 'foos' has PK 'foos_id'. When renaming tables via ::Diff
->extra( renamed_from => 'foos'then I get one of two possible breakages:The text was updated successfully, but these errors were encountered: