Skip to content
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

Migration error on upgrade when database is reset via manage.py #4839

Open
emkll opened this issue Sep 18, 2019 · 6 comments
Open

Migration error on upgrade when database is reset via manage.py #4839

emkll opened this issue Sep 18, 2019 · 6 comments
Labels
development env help wanted Issues we would definitely appreciate volunteer help with

Comments

@emkll
Copy link
Contributor

emkll commented Sep 18, 2019

Description

If a database was reset with ./manage.py reset, when upgrading to SecureDrop 1.0.0, the postint task will fail during the SQLAlchemy migration with the following error:

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) duplicate column: uuid
[SQL: ALTER TABLE sources_tmp ADD COLUMN uuid VARCHAR(36)]

Steps to Reproduce

  • Install on SecureDrop 1.0.0 (or before)
  • Reset the database ./manage.py reset
  • Run the postint sudo dpkg-reconfigure securedrop-app-code
  • observe the error message/failure above

Expected Behavior

  • The database migration should be applied

Actual Behavior

  • The database migration fails and the postinst action fails, the package
  • Server error on Journalist and Source interfaces

Comments

Because manage.py is mostly dev-facing, this should not affect production instances.

@eloquence eloquence added this to Near Term Backlog in SecureDrop Team Board Sep 18, 2019
@eloquence eloquence added this to the 1.1.0 milestone Sep 18, 2019
@eloquence eloquence moved this from Near Term Backlog to Nominated for next sprint in SecureDrop Team Board Sep 19, 2019
@emkll
Copy link
Contributor Author

emkll commented Sep 19, 2019

In case this happens to someone in dev/testing, deleting (or moving) the database in /var/lib/securedrop/db.sqlite and re running sudo dpkg-reconfigure securedrop-app-code will reinitialize a new (empty) working database.

@eloquence
Copy link
Member

eloquence commented Sep 19, 2019

A proper fix won't make it to 1.1.0 but proposed a string change in #4850 for risk mitigation.

@eloquence eloquence moved this from Nominated for next sprint to Near Term Backlog in SecureDrop Team Board Sep 19, 2019
@emkll
Copy link
Contributor Author

emkll commented Sep 23, 2019

If no one (in dev) uses this functionality, and the same functionality is achieved by simply deleting the database locally and reconfiguring the securedrop-app-code package, we should consider simply removing the code.

@zenmonkeykstop
Copy link
Contributor

will dpkg-reconfigure nuke the submissions directory? (And I guess will either it or the reset command do so safely?) I do use this occasionally in testing.

@eloquence eloquence moved this from Near Term Backlog - SD Workstation to Near Term Backlog - SD Core in SecureDrop Team Board Oct 7, 2019
@rocodes
Copy link
Contributor

rocodes commented Jun 4, 2020

Update for our future selves that dkpg-reconfigure --force was required in my case, and I also ran into this due to some ./manage.py reset and other QA-related shenanigans.

@eloquence eloquence added development env help wanted Issues we would definitely appreciate volunteer help with labels Feb 22, 2021
@sssoleileraaa
Copy link
Contributor

I ran into this issue today and #4839 (comment) worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development env help wanted Issues we would definitely appreciate volunteer help with
Projects
No open projects
SecureDrop Team Board
Near Term - SecureDrop Server
Development

No branches or pull requests

5 participants