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

20210628154900_create_detached_partitions_table.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cf31d71835a4214530f1f047ad3b2391ba90bba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

class CreateDetachedPartitionsTable < ActiveRecord::Migration[6.1]
  include Gitlab::Database::MigrationHelpers

  def up
    create_table_with_constraints :detached_partitions do |t|
      t.timestamps_with_timezone null: false
      t.datetime_with_timezone :drop_after, null: false
      t.text :table_name, null: false

      # Postgres identifier names can be up to 63 bytes
      # See https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
      t.text_limit :table_name, 63
    end
  end

  def down
    with_lock_retries do
      drop_table :detached_partitions
    end
  end
end