Opened 9 years ago
Closed 8 years ago
#12777 closed defect (fixed)
Running upgrade db2 failed: relation "codereviews" does not exist
Reported by: | ntmlod | Owned by: | Cinc-th |
---|---|---|---|
Priority: | normal | Component: | PeerReviewPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description
Browsing the existing tickets, there have been several issues with the database related to the case sensitive and the renaming of some tables.
Starting from a fresh installation of the plugin, no problem to compile the egg file but the database upgrade failed with the aforementioned message.
After some tests, it seems that the script detects a local database version 1 (from _get_version
function in model.py
) instead of version 0 and so skip the creation of the initial tables and run the db2 upgrade which can only crash.
Attachments (0)
Change History (7)
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
I fixed the case sensitive problem with a workaround solution by adding double quotes on each item:
cursor.execute("""INSERT INTO peer_review(review_id,owner,status, created, name, notes) SELECT \"IDReview\", \"Author\", \"Status\", \"DateCreate\", \"Name\", \"Notes\" FROM \"CodeReviews\"""") cursor.execute("""INSERT INTO peer_reviewer(review_id,reviewer,status, vote) SELECT \"IDReview\", \"Reviewer\", \"Status\", \"Vote\" FROM \"Reviewers\"""") cursor.execute("""INSERT INTO peer_review_file(file_id,review_id,path,line_start,line_end, revision) SELECT \"IDFile\", \"IDReview\", \"Path\", \"LineStart\", \"LineEnd\", \"Version\" FROM \"ReviewFiles\"""") cursor.execute("""INSERT INTO peer_review_comment(comment_id,file_id,parent_id,line_num,author,comment, attachment_path, created) SELECT \"IDComment\", \"IDFile\", \"IDParent\", \"LineNum\", \"Author\", \"Text\", \"AttachmentPath\", \"DateCreate\" FROM \"ReviewComments\"""") ... cursor.execute("DROP TABLE \"CodeReviews\"") cursor.execute("DROP TABLE \"Reviewers\"") cursor.execute("DROP TABLE \"ReviewFiles\"") cursor.execute("DROP TABLE \"ReviewComments\"")
Then launch again the upgrade:
PeerReview: running upgrade db2 checking peerreviewfile_version checking peerreviewcomment_version checking peerreviewer_version inserting peerreviewer_version Custom and change tables for PeerReview need update. Dropping peerreview_change Dropping peerreview_custom Dropping peerreviewer_change Dropping peerreviewer_custom Dropping peerreviewfile_change Dropping peerreviewfile_custom Dropping peerreviewcomment_change Dropping peerreviewcomment_custom Recreating change and custom tables. The upgrade failed. Please fix the issue and try again. InternalError: current transaction is aborted, commands ignored until end of transaction block
comment:3 Changed 8 years ago by
Cc: | Cinc-th added |
---|
comment:4 Changed 8 years ago by
Cc: | Cinc-th removed |
---|---|
Owner: | changed from Olemis Lang to Cinc-th |
Status: | new → assigned |
Upgrading is a mess because of backwards compatibility requirements and other reasons. I'll review the upgrade process next week.
I suppose you are not using SQLite and trying to perform a first time install.
comment:5 Changed 8 years ago by
PeerReviewPlugin: new upgrade mechanism
- Create database tables directly for first time installs instead of performing each upgrade step. This fails for backends other than SQLite.
- don't try to upgrade ancient versions of the plugin. If you use such a version create a support ticket.
This should fix the current problem.
comment:6 Changed 8 years ago by
I cleaned my previous installation (tables & keys), updated the plugin to the last revision and installed it.
No issue on the database upgrade and I can start using this new feature, thanks Cinc-th.
comment:7 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Glad to hear installation succeeded.
I made few actions in order to figure out what's going on:
_get_version
to return '0'However it is there: