Welcome to mirror list, hosted at ThFree Co, Russian Federation.

postgres_async_foreign_key_validation.rb « async_foreign_keys « database « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 76403f9a643b6a6ed95f2787b26d412b07f372e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module Gitlab
  module Database
    module AsyncForeignKeys
      class PostgresAsyncForeignKeyValidation < SharedModel
        self.table_name = 'postgres_async_foreign_key_validations'

        MAX_IDENTIFIER_LENGTH = Gitlab::Database::MigrationHelpers::MAX_IDENTIFIER_NAME_LENGTH
        MAX_LAST_ERROR_LENGTH = 10_000

        validates :name, presence: true, uniqueness: true, length: { maximum: MAX_IDENTIFIER_LENGTH }
        validates :table_name, presence: true, length: { maximum: MAX_IDENTIFIER_LENGTH }
        validates :last_error, length: { maximum: MAX_LAST_ERROR_LENGTH }

        scope :ordered, -> { order(attempts: :asc, id: :asc) }
      end
    end
  end
end