This Bug Report affects these Traffic Control components:
Current behavior:
If run using a database dump, the database tests fail to roll back the 2021080408053529_fix_indices migration:
+ ./db/admin --env=production down
Error running migrate down: migration failed: relation "pys_location_last_updated_idx" already exists in line 0: /*
Line it fails at:
|
ALTER INDEX phys_location_last_updated_idx RENAME TO pys_location_last_updated_idx; |
Somehow, an index named pys_location_last_updated_idx still exists after running
|
ALTER INDEX pys_location_last_updated_idx RENAME TO phys_location_last_updated_idx; |
I cannot reproduce this issue outside of the DB tests, but this is not a Migrate-specific issue. If you run the DB tests with Goose at 3cc78ea~ but add the Goose equivalent of 2021080408053529_fix_indices:
-- +goose Up
-- SQL in section 'Up' is executed when this migration is applied
ALTER INDEX pys_location_last_updated_idx RENAME TO phys_location_last_updated_idx;
DROP INDEX topology_last_updated_idx;
CREATE INDEX topology_last_updated_idx ON topology (last_updated DESC NULLS LAST);
-- +goose Down
-- SQL section 'Down' is executed when this migration is rolled back
ALTER INDEX phys_location_last_updated_idx RENAME TO pys_location_last_updated_idx;
DROP INDEX topology_last_updated_idx;
CREATE INDEX topology_last_updated_idx ON topology_cachegroup (last_updated DESC NULLS LAST);
then the TO DB tests will still fail.
+ ./db/admin --env=production down
Running goose down...
goose: migrating db environment 'production', current version: 2021080408053529, target: 2021070800000000
2021/08/19 18:52:11 FAIL 2021080408053529_fix_indices.sql (pq: relation "pys_location_last_updated_idx" already exists), quitting migration.
Can't run goose: exit status 1
Back to Migrate: If the ALTER INDEX RENAME in the up migration is changed to
DROP INDEX pys_location_last_updated_idx;
CREATE INDEX phys_location_last_updated_idx ON phys_location (last_updated DESC NULLS LAST);
then the pys_location_last_updated_idx still does not get removed in the up migration in the TO DB tests:
+ ./db/admin --env=production down
Error running migrate down: migration failed: relation "pys_location_last_updated_idx" already exists in line 0: /*
Expected behavior:
The Traffic Ops DB tests should succeed on all up/down migrations, with or without a database dump.
Steps to reproduce:
-
Dump the Traffic Ops database
-
Run the Traffic Ops DB tests using a database dump.
cd traffic_ops_db/test/docker
cp path-to-the-dump.dump initdb.d/
docker-compose build --parallel
docker-compose up trafficops-db-admin
This Bug Report affects these Traffic Control components:
Current behavior:
If run using a database dump, the database tests fail to roll back the
2021080408053529_fix_indicesmigration:Line it fails at:
trafficcontrol/traffic_ops/app/db/migrations/2021080408053529_fix_indices.down.sql
Line 18 in 308db85
Somehow, an index named
pys_location_last_updated_idxstill exists after runningtrafficcontrol/traffic_ops/app/db/migrations/2021080408053529_fix_indices.up.sql
Line 18 in 308db85
I cannot reproduce this issue outside of the DB tests, but this is not a Migrate-specific issue. If you run the DB tests with Goose at
3cc78ea~but add the Goose equivalent of2021080408053529_fix_indices:then the TO DB tests will still fail.
Back to Migrate: If the
ALTER INDEX RENAMEin the up migration is changed tothen the
pys_location_last_updated_idxstill does not get removed in the up migration in the TO DB tests:Expected behavior:
The Traffic Ops DB tests should succeed on all up/down migrations, with or without a database dump.
Steps to reproduce:
Dump the Traffic Ops database
Run the Traffic Ops DB tests using a database dump.