Skip to content

Add support for sequences for database validation schema

What does this MR do and why?

This adds basic support for identifying missing database sequences.

This does not yet:

  • Check ownership of sequences
  • Check that columns have properly been assigned to the right sequence.

References

Relates to #396878

How to set up and validate locally

mysql-17.9.2.sql

In bin/rails console, I ran:

bad_sql = Gitlab::Schema::Validation::Sources::StructureSql.new('/tmp/mysql-17.9.2.sql')
db = Gitlab::Schema::Validation::Sources::Database.new(ActiveRecord::Base.connection)
validators = [Gitlab::Schema::Validation::Validators::MissingSequences]
diffs = Gitlab::Schema::Validation::Runner.new(db, bad_sql, validators: validators).execute
diffs.map(&:error_message)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports

Loading