sqlite: Error on Upgrade Database Version, another table already exists
Sometimes we have some problems updating the database schema.
At some point, one of the temporary tables has not been deleted and when you do the update again the table already exists and you cannot continue.
Error: Open: Error in creating the databaseError: onUpgrade executeStatementProcess failed
java.lang.Exception: Error: executeStatementProcess failed
java.lang.Exception: Error: backupTables failed
java.lang.Exception: Error: backupTable failed
java.lang.Exception: there is already another table or index with this name: _temp_messages: , while compiling: ALTER TABLE messages RENAME TO _temp_messages;
Is there a way to drop the temporary tables before starting the upgrade schema?
Versions
@capacitor/android : 3.4.0
@capacitor-community/sqlite: 3.4.0
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (14 by maintainers)
@dragermrb @tobiasmuecksch this is fixed in 3.4.3-1, i also add both of you in the contributor’s list. Thanks for your contribution
@dragermrb thanks for using the plugin, if there is
_temp_YOURTABLENAMEalready existing means that one of the previous upgrade did not complete successfully. So adding a finally block like you suggest is correct in Android i will have to see how defer works in swift i never use it. Any how if will have also to add a drop all_temp_*at the beginning of the process. @tobiasmuecksch thanks for trying to help.