From 32fd4cd5e2134511936899d6bcc4aaf18b9be6fd Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 25 Feb 2020 21:09:23 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- ...dd_index_on_pages_domain_on_domain_lowercase.rb | 19 +++++++++++++++ ...00221074028_add_mr_metrics_first_approved_at.rb | 13 ++++++++++ ...2216_remove_repository_storage_from_snippets.rb | 28 ++++++++++++++++++++++ db/schema.rb | 3 ++- 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20200221023320_add_index_on_pages_domain_on_domain_lowercase.rb create mode 100644 db/migrate/20200221074028_add_mr_metrics_first_approved_at.rb create mode 100644 db/post_migrate/20200221142216_remove_repository_storage_from_snippets.rb (limited to 'db') diff --git a/db/migrate/20200221023320_add_index_on_pages_domain_on_domain_lowercase.rb b/db/migrate/20200221023320_add_index_on_pages_domain_on_domain_lowercase.rb new file mode 100644 index 00000000000..53f8f5e7f81 --- /dev/null +++ b/db/migrate/20200221023320_add_index_on_pages_domain_on_domain_lowercase.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddIndexOnPagesDomainOnDomainLowercase < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_NAME = 'index_pages_domains_on_domain_lowercase' + + disable_ddl_transaction! + + def up + add_concurrent_index :pages_domains, 'LOWER(domain)', name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :pages_domains, INDEX_NAME + end +end diff --git a/db/migrate/20200221074028_add_mr_metrics_first_approved_at.rb b/db/migrate/20200221074028_add_mr_metrics_first_approved_at.rb new file mode 100644 index 00000000000..993905f66ce --- /dev/null +++ b/db/migrate/20200221074028_add_mr_metrics_first_approved_at.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddMrMetricsFirstApprovedAt < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + add_column :merge_request_metrics, :first_approved_at, :datetime_with_timezone + end + + def down + remove_column :merge_request_metrics, :first_approved_at + end +end diff --git a/db/post_migrate/20200221142216_remove_repository_storage_from_snippets.rb b/db/post_migrate/20200221142216_remove_repository_storage_from_snippets.rb new file mode 100644 index 00000000000..f9ef985218b --- /dev/null +++ b/db/post_migrate/20200221142216_remove_repository_storage_from_snippets.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class RemoveRepositoryStorageFromSnippets < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + return unless column_exists?(:snippets, :repository_storage) + + remove_column :snippets, :repository_storage + end + + def down + return if column_exists?(:snippets, :repository_storage) + + add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault + :snippets, + :repository_storage, + :string, + default: 'default', + limit: 255, + allow_null: false + ) + end +end diff --git a/db/schema.rb b/db/schema.rb index 8052a93e841..36bf8ad5e01 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2537,6 +2537,7 @@ ActiveRecord::Schema.define(version: 2020_02_24_163804) do t.integer "diff_size" t.integer "modified_paths_size" t.integer "commits_count" + t.datetime_with_timezone "first_approved_at" t.index ["first_deployed_to_production_at"], name: "index_merge_request_metrics_on_first_deployed_to_production_at" t.index ["latest_closed_at"], name: "index_merge_request_metrics_on_latest_closed_at", where: "(latest_closed_at IS NOT NULL)" t.index ["latest_closed_by_id"], name: "index_merge_request_metrics_on_latest_closed_by_id" @@ -3062,6 +3063,7 @@ ActiveRecord::Schema.define(version: 2020_02_24_163804) do t.boolean "wildcard", default: false, null: false t.integer "usage", limit: 2, default: 0, null: false t.integer "scope", limit: 2, default: 2, null: false + t.index "lower((domain)::text)", name: "index_pages_domains_on_domain_lowercase" t.index ["certificate_source", "certificate_valid_not_after"], name: "index_pages_domains_need_auto_ssl_renewal", where: "(auto_ssl_enabled = true)" t.index ["domain", "wildcard"], name: "index_pages_domains_on_domain_and_wildcard", unique: true t.index ["project_id", "enabled_until"], name: "index_pages_domains_on_project_id_and_enabled_until" @@ -3938,7 +3940,6 @@ ActiveRecord::Schema.define(version: 2020_02_24_163804) do t.string "encrypted_secret_token", limit: 255 t.string "encrypted_secret_token_iv", limit: 255 t.boolean "secret", default: false, null: false - t.string "repository_storage", limit: 255, default: "default", null: false t.index ["author_id"], name: "index_snippets_on_author_id" t.index ["content"], name: "index_snippets_on_content_trigram", opclass: :gin_trgm_ops, using: :gin t.index ["created_at"], name: "index_snippets_on_created_at" -- cgit v1.2.1