Skip to content

ValueError: while running sqlmigrate on oauth app #7971

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

Open
saadmk11 opened this issue Mar 2, 2021 · 1 comment
Open

ValueError: while running sqlmigrate on oauth app #7971

saadmk11 opened this issue Mar 2, 2021 · 1 comment
Labels
Accepted Accepted issue on our roadmap

Comments

@saadmk11
Copy link
Member

saadmk11 commented Mar 2, 2021

Details

Running sqlmigrate management command on oauth app causes ValueError. This is true for most of the oauth migration files that reference projects.Project

There is an old Django ticket for reference: https://code.djangoproject.com/ticket/28056

Example Command

python manage.py sqlmigrate oauth 0012

Output

ValueError: The field oauth.RemoteRepository.project was declared with a lazy reference to 'projects.project', but app 'projects' isn't installed.

Possible Solution

Here the possible solution is to add a project migration as a dependancy to all the migrations that are failing. for example:

dependencies = [
        ('oauth', '0010_index_full_name'),
        ('projects', '0067_change_max_length_feature_id'),  # <---- adding this
]

This issue might be happening in other places of the codebase as well.

@humitos
Copy link
Member

humitos commented Mar 3, 2021

I'm fine adding that projects' migration dependency to that file. I had to do something similar to be able to workaround it for #7949 (comment)

This issue might be happening in other places of the codebase as well.

May be good to run the sqlmigrate command on all the migrations to find out if there are other dependencies required.

Feel free to send a PR for these changes 😉

@humitos humitos added the Accepted Accepted issue on our roadmap label Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap
Projects
None yet
Development

No branches or pull requests

2 participants