summaryrefslogtreecommitdiff
path: root/db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb')
-rw-r--r--db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb b/db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb
new file mode 100644
index 00000000000..cfe0daaf50f
--- /dev/null
+++ b/db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class RemoveNamespacesTrialEndsOn < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :namespaces, 'index_namespaces_on_trial_ends_on'
+
+ with_lock_retries do
+ remove_column :namespaces, :trial_ends_on
+ end
+ end
+
+ def down
+ unless column_exists?(:namespaces, :trial_ends_on)
+ with_lock_retries do
+ add_column :namespaces, :trial_ends_on, :datetime_with_timezone
+ end
+ end
+
+ add_concurrent_index :namespaces, :trial_ends_on, using: 'btree', where: 'trial_ends_on IS NOT NULL'
+ end
+end