Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a check to test the UNIQUE KEYs #317

Merged
merged 1 commit into from
Oct 23, 2020

Conversation

muffato
Copy link
Contributor

@muffato muffato commented Oct 7, 2020

See https://www.ebi.ac.uk/panda/jira/browse/ENSCORESW-3564 : UNIQUE KEYs that comprise a column that is NULL-able allow duplicated rows if they contain one NULL.
This is not something we want in the Compara schema, and it's caused some issues with the theobroma_cacao renaming this release, so here is a new DC to check those. It's structured the same way as ForeignKeysCompara and is quite generic. It could probably be applied onto other database types, should people need to.

@muffato muffato requested a review from a team October 7, 2020 21:29
@coveralls
Copy link

Pull Request Test Coverage Report for Build 1471

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 95.867%

Totals Coverage Status
Change from base Build 1469: 0.0%
Covered Lines: 1879
Relevant Lines: 1960

💛 - Coveralls

Copy link
Contributor

@james-monkeyshines james-monkeyshines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine, and I take you point about having methods to parse SQL. However, was there a reason why you didn't query the mysql schema to get the unique keys? I think that'd tend to be a bit more robust, e.g.

select
  table_name,
  index_name,
  group_concat(column_name order by seq_in_index) as index_columns,
  index_type
from
  information_schema.statistics
where
  table_schema = database() and
  non_unique = 0 and
  index_name <> 'PRIMARY'
group by table_name, index_name, index_type
order by index_name;

@james-monkeyshines james-monkeyshines merged commit f4df3d1 into release/103 Oct 23, 2020
@james-monkeyshines james-monkeyshines deleted the feature/check_unique_keys branch October 23, 2020 12:08
@muffato
Copy link
Contributor Author

muffato commented Oct 26, 2020

Yes, good point, I could have queried the list of unique keys from the schema itself. I think I was worried the database wouldn't have the correct schema in some situations. We had an issue last release with MySQLTransfer because it copies the data and the schema, and our source database was on an older version of the schema, so I preferred taking table.sql as the truth.

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.

None yet

4 participants