Django Evo Questiion when Update customized ReviewBoard 3 database to ReviewBoard 5

64 views
Skip to first unread message

Work Bot

unread,
Dec 13, 2023, 8:36:46 PM12/13/23
to Review Board Community
Hi Reviewboard community,

I am currently trying to update my Reviewboard 3 to Reviewboard 5. Everything went well until I touched data migration part. I went through Reviewboard official Getting Started page as well as Django Evolution documentations, and none of them helped in my situation. 

Here is the background information about my project:
- I have customized data schemas and modified some exisiting table from RB3 original databases

- I have my environment setup ready for Reviewboard 5 based on the instuctions from [Getting Started (notion.site)]

- I used ./reviewboard/manage.py evolve --hint to initilize the Database upgrade process, and I received following error: 
CommandError: Cannot use hinted evolution: AddField or ChangeField mutation for "AccessToken.created" in "oauth2_provider" requires user-specified initial value.

- After some searches, I located down to this file: reviewboard/admin/custom_evolutions/oauth2_provider/upgrade_to_1_6_3.py, around line 56. The code there states:
    AddField('AccessToken', 'created', models.DateTimeField, initial=timezone.now),

- Thus, I modified initial value in the above code and run ./reviewboard/manage.py evolve --hint again, but nothing changed, and received same error code. 

 My understanding is that Reviewboard is asking Django Evo to use upgrade_to_1_6_3.py to apply some changes on SQL database. Thus, I feel weird when the same error code exists after I made changes to this file (I even commented almost the entire upgrade_to_1_6_3.py file away)

I genuinely thanks any insights on this issue.

Sincerely. 



Work Bot

unread,
Dec 14, 2023, 2:00:15 PM12/14/23
to Review Board Community

Some follow up questions/information:
When I execute ./reviewboard/manage.py evolve, I get following outputs in my terminal:
The stored evolutions do not completely resolve all model changes.

Run `./manage.py evolve --hint` to see a suggestion for the changes
required.


The following are the changes that could not be resolved:

The application AAAA has been deleted
The application BBBB has been deleted
The application CCCC has been deleted
The application DDDD has been deleted
The application EEEE has been deleted
The application FFFF has been deleted
In model notifications.WebHookTarget:
    In field 'url':
        Property 'max_length' has changed
In model oauth.Application:
    Field 'created' has been added
    Field 'updated' has been added
    Field 'algorithm' has been added
    In field 'user':
        Property 'null' has changed
    In field 'id':
        Property 'field_type' has changed
CommandError: Your models contain changes that Django Evolution cannot resolve automatically.


What does Django Evolution mean when it says, "The following are the changes that could not be resolved"? Do I need to write/edit corresponding revolution to delete those customized applications(AAAA, BBBB, etc) or manually remove them from my Database through SQL? Similarly, when Django Evolution says xxx has been added or changed, does it mean it can process the evolution .py files, or it can't? 

Thanks for the helps!

Christian Hammond

unread,
Dec 16, 2023, 5:11:46 AM12/16/23
to revie...@googlegroups.com
Hi,

This is a tricky situation, since no part of our upgrade process expects you to customize your database. The Notion docs should be avoided, as those are for the development of Review Board, and don't apply to a production install. In particular, you don't want to follow Getting Started (as that's only for a development install) or the Django Evolution docs (as that and the 'evolve' command are only for our own development of Review Board, and are dangerous to use in production).

A production install must use an official build of Review Board, installed via pip, with a Review Board site directory managed by the 'rb-site' tool.

Similarly, all upgrades must go through 'rb-site upgrade', since that sets up some state required to carefully manage the upgrade process. Running 'evolve' manually, or making changes to tables, can corrupt state, and require a careful database repair by our team.

If you have a site directory, and 'rb-site upgrade' ends up failing with errors, go ahead and show me the output. There should also be a log file that we can look at (though this may have confidential data in it).

To resolve this, though, we'll probably need to get a support contract set up so we can work with you to initiate a database repair. This involves special tools and processes we have internally, and can take several hours or longer, depending on the changes made to the database and the discrepancies introduced to the evolution history. Making changes via SQL won't resolve the issue. I'd advise avoiding any further schema or other changes until we know more about what 'rb-site upgrade' does.

Christian

--
Supercharge your Review Board with Power Pack: https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups "Review Board Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reviewboard/1ae682db-e194-4d2c-a3ab-ec911bdef42bn%40googlegroups.com.


--
Christian Hammond
President/CEO of Beanbag
Makers of Review Board
Reply all
Reply to author
Forward
0 new messages