summaryrefslogtreecommitdiff
path: root/db/migrate/20210628154900_create_detached_partitions_table.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20210628154900_create_detached_partitions_table.rb')
-rw-r--r--db/migrate/20210628154900_create_detached_partitions_table.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20210628154900_create_detached_partitions_table.rb b/db/migrate/20210628154900_create_detached_partitions_table.rb
new file mode 100644
index 00000000000..05290f4dfb9
--- /dev/null
+++ b/db/migrate/20210628154900_create_detached_partitions_table.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class CreateDetachedPartitionsTable < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def change
+ 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
+end