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
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 00:10:04 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 00:10:04 +0300
commit83d921d51bd5bf8bd0ecd078706d7c037fb711cb (patch)
treef8f43552f05e747c06d16ac82b23eb33182a9e8f /db
parenta8476fe0cd764ac054763032b7cf6e63b0b493c5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb12
-rw-r--r--db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb2
-rw-r--r--db/migrate/20210611100359_rebuild_index_for_cadence_iterations_automation.rb39
-rw-r--r--db/schema_migrations/202106111003591
4 files changed, 43 insertions, 11 deletions
diff --git a/db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb b/db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb
index 99178bc5b04..62ccdb6a4fd 100644
--- a/db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb
+++ b/db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb
@@ -8,18 +8,10 @@ class AddIndexForCadenceIterationsAutomation < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
def up
- return if index_exists_by_name?(:iterations_cadences, INDEX_NAME)
-
- execute(
- <<-SQL
- CREATE INDEX CONCURRENTLY #{INDEX_NAME} ON iterations_cadences
- USING BTREE(automatic, duration_in_weeks, (DATE ((COALESCE("iterations_cadences"."last_run_date", DATE('01-01-1970')) + "iterations_cadences"."duration_in_weeks" * INTERVAL '1 week'))))
- WHERE duration_in_weeks IS NOT NULL
- SQL
- )
+ # no-op
end
def down
- remove_concurrent_index_by_name :iterations_cadences, INDEX_NAME
+ # no-op
end
end
diff --git a/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb b/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb
index d5a97b6e761..c164183fbf8 100644
--- a/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb
+++ b/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb
@@ -8,7 +8,7 @@ class EnableEnforceSshKeyExpiration < ActiveRecord::Migration[6.0]
def up
ApplicationSetting.reset_column_information
- ApplicationSetting.where.not(enforce_ssh_key_expiration: false).each do |application_setting|
+ ApplicationSetting.where.not(enforce_ssh_key_expiration: true).each do |application_setting|
application_setting.update!(enforce_ssh_key_expiration: true)
end
end
diff --git a/db/migrate/20210611100359_rebuild_index_for_cadence_iterations_automation.rb b/db/migrate/20210611100359_rebuild_index_for_cadence_iterations_automation.rb
new file mode 100644
index 00000000000..ecd8bac22be
--- /dev/null
+++ b/db/migrate/20210611100359_rebuild_index_for_cadence_iterations_automation.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+class RebuildIndexForCadenceIterationsAutomation < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'cadence_create_iterations_automation'
+
+ disable_ddl_transaction!
+
+ def up
+ return if index_exists_and_is_valid?
+
+ remove_concurrent_index_by_name :iterations_cadences, INDEX_NAME
+
+ disable_statement_timeout do
+ execute(
+ <<-SQL
+ CREATE INDEX CONCURRENTLY #{INDEX_NAME} ON iterations_cadences
+ USING BTREE(automatic, duration_in_weeks, (DATE ((COALESCE("iterations_cadences"."last_run_date", DATE('01-01-1970')) + "iterations_cadences"."duration_in_weeks" * INTERVAL '1 week'))))
+ WHERE duration_in_weeks IS NOT NULL
+ SQL
+ )
+ end
+ end
+
+ def down
+ remove_concurrent_index_by_name :iterations_cadences, INDEX_NAME
+ end
+
+ def index_exists_and_is_valid?
+ execute(
+ <<-SQL
+ SELECT identifier
+ FROM postgres_indexes
+ WHERE identifier LIKE '%#{INDEX_NAME}' AND valid_index=TRUE
+ SQL
+ ).any?
+ end
+end
diff --git a/db/schema_migrations/20210611100359 b/db/schema_migrations/20210611100359
new file mode 100644
index 00000000000..058f7c8ff4e
--- /dev/null
+++ b/db/schema_migrations/20210611100359
@@ -0,0 +1 @@
+9429a8adca0bc85167f64e76d8d72b45d09d4303a01bd9c4ca39560bb4d89799 \ No newline at end of file