Module: Gitlab::Database::PartitionHelpers

Included in:
AsyncIndexes::MigrationHelpers, MigrationHelpers, Migrations::ForeignKeyHelpers
Defined in:
lib/gitlab/database/partition_helpers.rb

Instance Method Summary collapse

Instance Method Details

#partition?(table_name) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
# File 'lib/gitlab/database/partition_helpers.rb', line 6

def partition?(table_name)
  if view_exists?(:postgres_partitions)
    Gitlab::Database::PostgresPartition.partition_exists?(table_name)
  else
    Gitlab::Database::PostgresPartition.legacy_partition_exists?(table_name)
  end
end

#table_partitioned?(table_name) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
# File 'lib/gitlab/database/partition_helpers.rb', line 14

def table_partitioned?(table_name)
  Gitlab::Database::PostgresPartitionedTable
    .find_by_name_in_current_schema(table_name)
    .present?
end