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

change server primary key to only id#4994

Merged
ocket8888 merged 2 commits intoapache:masterfrom
mattjackson220:serverPkId
Sep 15, 2020
Merged

change server primary key to only id#4994
ocket8888 merged 2 commits intoapache:masterfrom
mattjackson220:serverPkId

Conversation

@mattjackson220
Copy link
Contributor

What does this PR (Pull Request) do?

This PR updates the server table so that only the id is the primary key instead of the id, cachegroup, type, status, and profile

Which Traffic Control components are affected by this PR?

  • Traffic Ops

What is the best way to verify this PR?

verify that all unit and API tests are successful, verify that adding, editing, and deleting a server works as before except that servers cannot have the same id twice

If this is a bug fix, what versions of Traffic Control are affected?

The following criteria are ALL met by this PR

There are no test updates because it is covered by existing tests
There are no CHANGELOG updates since it is not a functionality change
There are no doc updates since it is just a db change

  • I have explained why tests are unnecessary
  • I have explained why documentation is unnecessary
  • An update to CHANGELOG.md is not necessary
  • This PR includes any and all required license headers
  • This PR ensures that database migration sequence is correct
  • This PR DOES NOT FIX A SERIOUS SECURITY VULNERABILITY (see the Apache Software Foundation's security guidelines for details)

Additional Information

@mattjackson220 mattjackson220 added bug something isn't working as intended low impact affects only a small portion of a CDN, and cannot itself break one Traffic Ops related to Traffic Ops labels Aug 27, 2020
@mitchell852 mitchell852 added the database relating to setup/installation/structure of the Traffic Ops database label Aug 28, 2020
@rimashah25
Copy link
Contributor

rimashah25 commented Sep 15, 2020

Manual tested (successful) as follows:

  1. Ran a POST /api/3.0/servers to create a new server. Returned 200 response
  2. Got the ID (eg 15) from the newly created server.
  3. Created another server with the ID (eg 15) received from step 2.
  4. Got the following error with a 400 response.
    {"alerts":[{"text":"server with id 15 already exists. Please do not provide an id.","level":"error"}]}
  5. I deleted the existing server (ID:15)
  6. Ran a POST call (/api/3.0/servers) with the same ID (15) and was able to create a new server.

Unit tests pass
API tests pass (v2/v3)
Code is formatted correctly
LGTM

@ocket8888 ocket8888 merged commit de27021 into apache:master Sep 15, 2020
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 low impact affects only a small portion of a CDN, and cannot itself break one Traffic Ops related to Traffic Ops

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Traffic Ops Server Primary key to be ID

4 participants