Skip to content

Commit

Permalink
Squash db migration that have already been released (7.x.x) (#7764)
Browse files Browse the repository at this point in the history
* Redump create_tables.sql with migrations through timestamp 2022050916074300

* Redump create_tables.sql with migrations through timestamp 2022050916074300

* Remove migrations that existed at RELEASE-7.0.1

* updated files for DB migration

* removed changes specific to mac

* added changelog entry

* formatting

* formatting-1

* update create_tables file

* missing semicolon

* copy-paste table error

* adding a unique constraint for cdn lock

* addressed review comments.

* addressed review comments-1.

* addressed review comments-2.

* fixed roles

* spelling correction

* Removed extra added fields by migration script and reordered statuses in seeds.sql

* added owner back for server

* added sed lines back

* updated first migration timestamp for failing tests
  • Loading branch information
rimashah25 committed Sep 7, 2023
1 parent d7b7d05 commit ac09159
Show file tree
Hide file tree
Showing 30 changed files with 422 additions and 981 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- [#7766](https://github.com/apache/trafficcontrol/pull/7766) *Traffic Portal* now uses TO APIv5

### Fixed
- [#7764](https://github.com/apache/trafficcontrol/pull/7764) *Traffic Ops* Collapsed DB migrations
- [#7767](https://github.com/apache/trafficcontrol/pull/7767) *Traffic Ops* Fixed ASN update logic for APIv5
- [RFC3339](https://github.com/apache/trafficcontrol/issues/5911)
- [#7759](https://github.com/apache/trafficcontrol/pull/7759) *Traffic Ops* Fixed `/profiles/{{ID}}/parameters` and `profiles/name/{{name}}/parameters` v5 APIs to respond with `RFC3339` timestamps.
Expand Down
5 changes: 2 additions & 3 deletions traffic_ops/app/db/SQUASH.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ under the License.

# Squashing database migrations

For convenience, [`squash_migrations.sh`](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/app/db/squash_migrations.sh) script squashes the migrations, but whoever PRs the result is responsible for verifying that the migrations are squashed and `LastSquashedMigrationVersion` in [`db/admin.go`](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/app/db/admin.go) is updated correctly, regardless of the result of having run the script.
For convenience, [`squash_migrations.sh`](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/app/db/squash_migrations.sh) script squashes the migrations, but whoever PRs the result is responsible for verifying that the migrations are squashed, regardless of the result of having run the script.

--------

Expand All @@ -43,8 +43,7 @@ And suppose the ATC [`master`](https://github.com/apache/trafficcontrol/commits/

1. In order to prepare database migrations for the next major release, in this case, ATC 148.0.0, migrations `1` and `3` should be collapsed into `create_tables.sql` and migrations `4` and `9` should remain in [`traffic_ops/app/db/migrations/`](https://github.com/apache/trafficcontrol/tree/master/traffic_ops/app/db/migrations/).

2. * Note that `3` is the migration timestamp of the last up/down migration set. Find the definition for `LastSquashedMigrationTimestamp` in [`traffic_ops/app/db/admin.go`](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/app/db/admin.go) and change it to `3`.
* After migrations from ATC 147.5.8 have been collapsed, the first migration version will be `4`. Find the definition for `FirstMigrationTimestamp` in [`traffic_ops/app/db/admin.go`](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/app/db/admin.go) and change it to `4`.
2. * After migrations from ATC 147.5.8 have been collapsed, the first migration version will be `4`. Find the definition for `FirstMigrationTimestamp` in [`traffic_ops/app/db/admin.go`](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/app/db/admin.go) and change it to `4`.

Past PRs that have collapsed the DB migrations:
- https://github.com/apache/trafficcontrol/pull/6065
Expand Down

0 comments on commit ac09159

Please sign in to comment.