Skip to content

Conversation

@morremeyer
Copy link
Member

We now connect to the database once with foreign keys disabled in sqlite to allow the migration.
gorm will still update the foreign keys as required.

Then we reconnect with foreign keys enabled and go from there.

This has the added benefit of making the tests easier to read and maintain.

Resolves #970.

@morremeyer morremeyer requested a review from a team as a code owner March 1, 2024 16:58
@codecov
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 41.66667% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 81.74%. Comparing base (48031b2) to head (6854f09).

Files Patch % Lines
pkg/models/database.go 45.45% 3 Missing and 3 partials ⚠️
main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #980      +/-   ##
==========================================
- Coverage   81.81%   81.74%   -0.07%     
==========================================
  Files          51       51              
  Lines        3718     3726       +8     
==========================================
+ Hits         3042     3046       +4     
- Misses        549      551       +2     
- Partials      127      129       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@morremeyer morremeyer merged commit b3453c9 into main Mar 1, 2024
@morremeyer morremeyer deleted the fix/db-migration branch March 1, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Database migration fails when upgrading to 5.1.0

2 participants