django-rename-app
django-rename-app copied to clipboard
Don't attempt to rename table if it doesn't exist
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.