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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/database/async_indexes/postgres_async_index.rb')
-rw-r--r--lib/gitlab/database/async_indexes/postgres_async_index.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/gitlab/database/async_indexes/postgres_async_index.rb b/lib/gitlab/database/async_indexes/postgres_async_index.rb
new file mode 100644
index 00000000000..236459e6216
--- /dev/null
+++ b/lib/gitlab/database/async_indexes/postgres_async_index.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Database
+ module AsyncIndexes
+ class PostgresAsyncIndex < ApplicationRecord
+ self.table_name = 'postgres_async_indexes'
+
+ MAX_IDENTIFIER_LENGTH = Gitlab::Database::MigrationHelpers::MAX_IDENTIFIER_NAME_LENGTH
+ MAX_DEFINITION_LENGTH = 2048
+
+ validates :name, presence: true, length: { maximum: MAX_IDENTIFIER_LENGTH }
+ validates :table_name, presence: true, length: { maximum: MAX_IDENTIFIER_LENGTH }
+ validates :definition, presence: true, length: { maximum: MAX_DEFINITION_LENGTH }
+
+ def to_s
+ definition
+ end
+ end
+ end
+ end
+end