Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

db/admin migrate: Migrate first migration explicitly if DB version's migration is squashed#6096

Merged
mitchell852 merged 8 commits intoapache:masterfrom
zrhoffman:avoid-migration-not-found
Aug 16, 2021
Merged

db/admin migrate: Migrate first migration explicitly if DB version's migration is squashed#6096
mitchell852 merged 8 commits intoapache:masterfrom
zrhoffman:avoid-migration-not-found

Conversation

@zrhoffman
Copy link
Copy Markdown
Member

This PR fixes an issue encountered migrating the database if a migration for the current DB migration version does not exist, typically because a migration at that version has been squashed into create_table.sql:

trafficops-db-admin_1  | error: no migration found for version 2021012200000000: read down for version 2021012200000000 : file does not existError running migrate up: no migration found for version 2021012200000000: read down for version 2021012200000000 : file does not exist
trafficops-db-admin_1  | DB upgrade failed!

Which Traffic Control components are affected by this PR?

  • Documentation
  • Traffic Ops

What is the best way to verify this PR?

  1. Migrate the DB using Goose at d96c13c~
  2. Dump the database and move the dump to traffic_ops_db/test/docker/initdb.d
  3. Run the Traffic Ops DB tests

If this is a bugfix, which Traffic Control versions contained the bug?

  • master branch only

PR submission checklist

@zrhoffman zrhoffman added bug something isn't working as intended Traffic Ops related to Traffic Ops database relating to setup/installation/structure of the Traffic Ops database labels Aug 10, 2021
@zrhoffman zrhoffman added this to the 6.0.0 milestone Aug 13, 2021
Comment thread traffic_ops/app/db/migrations/SQUASH.md Outdated
Comment thread traffic_ops/app/db/migrations/SQUASH.md Outdated
@zrhoffman zrhoffman changed the title db/admin: Set migration version to 0 before migrating if DB version's migration is squashed db/admin migrate: Migrate first migration explicitly if DB version's migration is squashed Aug 16, 2021
@rimashah25
Copy link
Copy Markdown
Contributor

LGTM. Ready for merge.

@mitchell852 mitchell852 merged commit 1183254 into apache:master Aug 16, 2021
@zrhoffman zrhoffman deleted the avoid-migration-not-found branch August 16, 2021 22:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug something isn't working as intended database relating to setup/installation/structure of the Traffic Ops database Traffic Ops related to Traffic Ops

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants