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>2019-12-02 18:06:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-02 18:06:36 +0300
commit556c79d6cc3d7b24ecbba3a79f8432eb3fcf5c7e (patch)
tree93c84c603316cdee73ce85949ba70e29ef78af32 /db
parentbffcdf9bca11a4d43cc40e3f382f03088d36f7c6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20180215181245_users_name_lower_index.rb4
-rw-r--r--db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb2
-rw-r--r--db/migrate/20180504195842_project_name_lower_index.rb4
-rw-r--r--db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb22
-rw-r--r--db/migrate/20190402150158_backport_enterprise_schema.rb3
-rw-r--r--db/migrate/20191125133353_add_target_path_to_broadcast_message.rb9
-rw-r--r--db/optional_migrations/composite_primary_keys.rb4
-rw-r--r--db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb16
-rw-r--r--db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb2
-rw-r--r--db/post_migrate/20180706223200_populate_site_statistics.rb4
-rw-r--r--db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb2
-rw-r--r--db/post_migrate/20180826111825_recalculate_site_statistics.rb4
-rw-r--r--db/schema.rb1
13 files changed, 26 insertions, 51 deletions
diff --git a/db/migrate/20180215181245_users_name_lower_index.rb b/db/migrate/20180215181245_users_name_lower_index.rb
index fa1a115a78a..46f02885c3f 100644
--- a/db/migrate/20180215181245_users_name_lower_index.rb
+++ b/db/migrate/20180215181245_users_name_lower_index.rb
@@ -11,15 +11,11 @@ class UsersNameLowerIndex < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
def up
- return unless Gitlab::Database.postgresql?
-
# On GitLab.com this produces an index with a size of roughly 60 MB.
execute "CREATE INDEX CONCURRENTLY #{INDEX_NAME} ON users (LOWER(name))"
end
def down
- return unless Gitlab::Database.postgresql?
-
execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME}"
end
end
diff --git a/db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb b/db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb
index ecb06dd4312..3d85a19b82f 100644
--- a/db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb
+++ b/db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb
@@ -18,7 +18,7 @@ class RescheduleCommitsCountForMergeRequestDiff < ActiveRecord::Migration[4.2]
def up
say 'Populating the MergeRequestDiff `commits_count` (reschedule)'
- execute("SET statement_timeout TO '60s'") if Gitlab::Database.postgresql?
+ execute("SET statement_timeout TO '60s'")
MergeRequestDiff.where(commits_count: nil).each_batch(of: BATCH_SIZE) do |relation, index|
start_id, end_id = relation.pluck('MIN(id), MAX(id)').first
diff --git a/db/migrate/20180504195842_project_name_lower_index.rb b/db/migrate/20180504195842_project_name_lower_index.rb
index fa74330d5d9..e789837193f 100644
--- a/db/migrate/20180504195842_project_name_lower_index.rb
+++ b/db/migrate/20180504195842_project_name_lower_index.rb
@@ -11,16 +11,12 @@ class ProjectNameLowerIndex < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
def up
- return unless Gitlab::Database.postgresql?
-
disable_statement_timeout do
execute "CREATE INDEX CONCURRENTLY #{INDEX_NAME} ON projects (LOWER(name))"
end
end
def down
- return unless Gitlab::Database.postgresql?
-
disable_statement_timeout do
execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME}"
end
diff --git a/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb b/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb
index 36f4770ff32..859e341d04b 100644
--- a/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb
+++ b/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb
@@ -5,34 +5,20 @@ class AddNotNullConstraintsToProjectAuthorizations < ActiveRecord::Migration[4.2
DOWNTIME = false
def up
- if Gitlab::Database.postgresql?
- # One-pass version for PostgreSQL
- execute <<~SQL
+ execute <<~SQL
ALTER TABLE project_authorizations
ALTER COLUMN user_id SET NOT NULL,
ALTER COLUMN project_id SET NOT NULL,
ALTER COLUMN access_level SET NOT NULL
- SQL
- else
- change_column_null :project_authorizations, :user_id, false
- change_column_null :project_authorizations, :project_id, false
- change_column_null :project_authorizations, :access_level, false
- end
+ SQL
end
def down
- if Gitlab::Database.postgresql?
- # One-pass version for PostgreSQL
- execute <<~SQL
+ execute <<~SQL
ALTER TABLE project_authorizations
ALTER COLUMN user_id DROP NOT NULL,
ALTER COLUMN project_id DROP NOT NULL,
ALTER COLUMN access_level DROP NOT NULL
- SQL
- else
- change_column_null :project_authorizations, :user_id, true
- change_column_null :project_authorizations, :project_id, true
- change_column_null :project_authorizations, :access_level, true
- end
+ SQL
end
end
diff --git a/db/migrate/20190402150158_backport_enterprise_schema.rb b/db/migrate/20190402150158_backport_enterprise_schema.rb
index 3f13b68c2f3..d1e911a04e6 100644
--- a/db/migrate/20190402150158_backport_enterprise_schema.rb
+++ b/db/migrate/20190402150158_backport_enterprise_schema.rb
@@ -464,15 +464,12 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0]
end
def update_environments
- return unless Gitlab::Database.postgresql?
return if index_exists?(:environments, :name, name: 'index_environments_on_name_varchar_pattern_ops')
execute('CREATE INDEX CONCURRENTLY index_environments_on_name_varchar_pattern_ops ON environments (name varchar_pattern_ops);')
end
def revert_environments
- return unless Gitlab::Database.postgresql?
-
remove_concurrent_index_by_name(
:environments,
'index_environments_on_name_varchar_pattern_ops'
diff --git a/db/migrate/20191125133353_add_target_path_to_broadcast_message.rb b/db/migrate/20191125133353_add_target_path_to_broadcast_message.rb
new file mode 100644
index 00000000000..65aa758e502
--- /dev/null
+++ b/db/migrate/20191125133353_add_target_path_to_broadcast_message.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddTargetPathToBroadcastMessage < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ add_column :broadcast_messages, :target_path, :string, limit: 255
+ end
+end
diff --git a/db/optional_migrations/composite_primary_keys.rb b/db/optional_migrations/composite_primary_keys.rb
index e0bb0312a35..1fcb9664ff6 100644
--- a/db/optional_migrations/composite_primary_keys.rb
+++ b/db/optional_migrations/composite_primary_keys.rb
@@ -27,8 +27,6 @@ class CompositePrimaryKeysMigration < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
def up
- return unless Gitlab::Database.postgresql?
-
disable_statement_timeout do
TABLES.each do |index|
add_primary_key(index)
@@ -37,8 +35,6 @@ class CompositePrimaryKeysMigration < ActiveRecord::Migration[4.2]
end
def down
- return unless Gitlab::Database.postgresql?
-
disable_statement_timeout do
TABLES.each do |index|
remove_primary_key(index)
diff --git a/db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb b/db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb
index 3b3cb4267d4..e363642b2ac 100644
--- a/db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb
+++ b/db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb
@@ -14,11 +14,9 @@ class RemovePermanentFromRedirectRoutes < ActiveRecord::Migration[4.2]
# These indexes were created on Postgres only in:
# ReworkRedirectRoutesIndexes:
# https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/16211
- if Gitlab::Database.postgresql?
- disable_statement_timeout do
- execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME_PERM};"
- execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME_TEMP};"
- end
+ disable_statement_timeout do
+ execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME_PERM};"
+ execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME_TEMP};"
end
remove_column(:redirect_routes, :permanent)
@@ -27,11 +25,9 @@ class RemovePermanentFromRedirectRoutes < ActiveRecord::Migration[4.2]
def down
add_column(:redirect_routes, :permanent, :boolean)
- if Gitlab::Database.postgresql?
- disable_statement_timeout do
- execute("CREATE INDEX CONCURRENTLY #{INDEX_NAME_PERM} ON redirect_routes (lower(path) varchar_pattern_ops) where (permanent);")
- execute("CREATE INDEX CONCURRENTLY #{INDEX_NAME_TEMP} ON redirect_routes (lower(path) varchar_pattern_ops) where (not permanent or permanent is null) ;")
- end
+ disable_statement_timeout do
+ execute("CREATE INDEX CONCURRENTLY #{INDEX_NAME_PERM} ON redirect_routes (lower(path) varchar_pattern_ops) where (permanent);")
+ execute("CREATE INDEX CONCURRENTLY #{INDEX_NAME_TEMP} ON redirect_routes (lower(path) varchar_pattern_ops) where (not permanent or permanent is null) ;")
end
end
end
diff --git a/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb b/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
index d44ec1036c4..f0257e303f7 100644
--- a/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
+++ b/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
@@ -16,8 +16,6 @@ class AddPathIndexToRedirectRoutes < ActiveRecord::Migration[4.2]
# This same index is also added in the `ReworkRedirectRoutesIndexes` so this
# is a no-op in most cases.
def up
- return unless Gitlab::Database.postgresql?
-
disable_statement_timeout do
unless index_exists_by_name?(:redirect_routes, INDEX_NAME)
execute("CREATE UNIQUE INDEX CONCURRENTLY #{INDEX_NAME} ON redirect_routes (lower(path) varchar_pattern_ops);")
diff --git a/db/post_migrate/20180706223200_populate_site_statistics.rb b/db/post_migrate/20180706223200_populate_site_statistics.rb
index 0859aa88866..6f887a0c18f 100644
--- a/db/post_migrate/20180706223200_populate_site_statistics.rb
+++ b/db/post_migrate/20180706223200_populate_site_statistics.rb
@@ -7,13 +7,13 @@ class PopulateSiteStatistics < ActiveRecord::Migration[4.2]
def up
transaction do
- execute('SET LOCAL statement_timeout TO 0') if Gitlab::Database.postgresql? # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
+ execute('SET LOCAL statement_timeout TO 0') # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
execute("UPDATE site_statistics SET repositories_count = (SELECT COUNT(*) FROM projects)")
end
transaction do
- execute('SET LOCAL statement_timeout TO 0') if Gitlab::Database.postgresql? # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
+ execute('SET LOCAL statement_timeout TO 0') # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
execute("UPDATE site_statistics SET wikis_count = (SELECT COUNT(*) FROM project_features WHERE wiki_access_level != 0)")
end
diff --git a/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb b/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb
index 9bf6aed833d..b272bad7f92 100644
--- a/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb
+++ b/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb
@@ -20,7 +20,7 @@ class MigrateNullWikiAccessLevels < ActiveRecord::Migration[4.2]
# We need to re-count wikis as previous attempt was not considering the NULLs.
transaction do
- execute('SET LOCAL statement_timeout TO 0') if Gitlab::Database.postgresql? # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
+ execute('SET LOCAL statement_timeout TO 0') # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
execute("UPDATE site_statistics SET wikis_count = (SELECT COUNT(*) FROM project_features WHERE wiki_access_level != 0)")
end
diff --git a/db/post_migrate/20180826111825_recalculate_site_statistics.rb b/db/post_migrate/20180826111825_recalculate_site_statistics.rb
index 7c1fca3884d..938707c9ba4 100644
--- a/db/post_migrate/20180826111825_recalculate_site_statistics.rb
+++ b/db/post_migrate/20180826111825_recalculate_site_statistics.rb
@@ -9,13 +9,13 @@ class RecalculateSiteStatistics < ActiveRecord::Migration[4.2]
def up
transaction do
- execute('SET LOCAL statement_timeout TO 0') if Gitlab::Database.postgresql? # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
+ execute('SET LOCAL statement_timeout TO 0') # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
execute("UPDATE site_statistics SET repositories_count = (SELECT COUNT(*) FROM projects)")
end
transaction do
- execute('SET LOCAL statement_timeout TO 0') if Gitlab::Database.postgresql? # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
+ execute('SET LOCAL statement_timeout TO 0') # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
execute("UPDATE site_statistics SET wikis_count = (SELECT COUNT(*) FROM project_features WHERE wiki_access_level != 0)")
end
diff --git a/db/schema.rb b/db/schema.rb
index 725bcec3767..4be04185af5 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -573,6 +573,7 @@ ActiveRecord::Schema.define(version: 2019_11_25_140458) do
t.string "font"
t.text "message_html", null: false
t.integer "cached_markdown_version"
+ t.string "target_path", limit: 255
t.index ["starts_at", "ends_at", "id"], name: "index_broadcast_messages_on_starts_at_and_ends_at_and_id"
end