blob: d3c928717217f072311e01b2ed48ba960306f00b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# frozen_string_literal: true
module Gitlab
module Database
module SchemaValidation
module Validators
class BaseValidator
ERROR_MESSAGE = 'A schema inconsistency has been found'
def initialize(structure_sql, database)
@structure_sql = structure_sql
@database = database
end
def self.all_validators
[
ExtraIndexes,
ExtraTriggers,
MissingIndexes,
MissingTriggers,
DifferentDefinitionIndexes,
DifferentDefinitionTriggers
]
end
def execute
raise NoMethodError, "subclasses of #{self.class.name} must implement #{__method__}"
end
private
attr_reader :structure_sql, :database
def build_inconsistency(validator_class, structure_sql_object, database_object)
Inconsistency.new(validator_class, structure_sql_object, database_object)
end
end
end
end
end
end
|