diff options
Diffstat (limited to 'lib/gitlab/database/async_constraints/postgres_async_constraint_validation.rb')
-rw-r--r-- | lib/gitlab/database/async_constraints/postgres_async_constraint_validation.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/gitlab/database/async_constraints/postgres_async_constraint_validation.rb b/lib/gitlab/database/async_constraints/postgres_async_constraint_validation.rb index 3e71deb6855..acc5dff9995 100644 --- a/lib/gitlab/database/async_constraints/postgres_async_constraint_validation.rb +++ b/lib/gitlab/database/async_constraints/postgres_async_constraint_validation.rb @@ -14,10 +14,11 @@ module Gitlab validates :name, presence: true, uniqueness: { scope: :table_name }, length: { maximum: MAX_IDENTIFIER_LENGTH } validates :table_name, presence: true, length: { maximum: MAX_IDENTIFIER_LENGTH } - enum constraint_type: { foreign_key: 0 } + enum constraint_type: { foreign_key: 0, check_constraint: 1 } scope :ordered, -> { order(attempts: :asc, id: :asc) } scope :foreign_key_type, -> { columns_hash.key?('constraint_type') ? foreign_key : all } + scope :check_constraint_type, -> { check_constraint } def self.table_available? connection.table_exists?(table_name) |