Skip to content
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

Don't attempt to rename table if it doesn't exist #14

Open
dodget opened this issue Feb 21, 2023 · 0 comments
Open

Don't attempt to rename table if it doesn't exist #14

dodget opened this issue Feb 21, 2023 · 0 comments

Comments

@dodget
Copy link

dodget commented Feb 21, 2023

Thanks for this package, it was a big help! One thing I noticed while trying to use it is that the following query was tripping up on models/tables that had been removed at some point from the original app:

query = (
    f'ALTER TABLE "{old_table_name}" '
    f'RENAME TO "{new_table_name}"'
)

Adding IF EXISTS to the query helped to skip tables that no longer exist.

query = (
    f'ALTER TABLE IF EXISTS "{old_table_name}" '
    f'RENAME TO "{new_table_name}"'
)

I can fork and submit a PR if you'd like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant