summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-01 00:08:41 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-01 00:08:41 +0000
commit72817fd7c07d1b812623f8d5e27fc7bcecb4eed5 (patch)
tree2e81b28a062212375bf17d1da0ff836d6b021469 /db
parent9db503ef9888c984b287af44d009d884e835ce04 (diff)
downloadgitlab-ce-72817fd7c07d1b812623f8d5e27fc7bcecb4eed5.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200128184209_add_usage_to_pages_domains.rb18
-rw-r--r--db/migrate/20200129034515_update_indexes_of_pages_domains_add_usage_domain_wildcard_remove_domain.rb21
-rw-r--r--db/migrate/20200129035446_rename_pages_domains_domain_type_to_scope.rb17
-rw-r--r--db/post_migrate/20200129035708_cleanup_rename_pages_domains_domain_type_to_scope.rb17
-rw-r--r--db/schema.rb10
5 files changed, 79 insertions, 4 deletions
diff --git a/db/migrate/20200128184209_add_usage_to_pages_domains.rb b/db/migrate/20200128184209_add_usage_to_pages_domains.rb
new file mode 100644
index 00000000000..292490078cd
--- /dev/null
+++ b/db/migrate/20200128184209_add_usage_to_pages_domains.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddUsageToPagesDomains < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ PAGES_USAGE = 0
+
+ disable_ddl_transaction!
+
+ def up
+ add_column_with_default :pages_domains, :usage, :integer, limit: 2, default: PAGES_USAGE, allow_null: false # rubocop:disable Migration/AddColumnWithDefault
+ end
+
+ def down
+ remove_column :pages_domains, :usage
+ end
+end
diff --git a/db/migrate/20200129034515_update_indexes_of_pages_domains_add_usage_domain_wildcard_remove_domain.rb b/db/migrate/20200129034515_update_indexes_of_pages_domains_add_usage_domain_wildcard_remove_domain.rb
new file mode 100644
index 00000000000..2f13567c540
--- /dev/null
+++ b/db/migrate/20200129034515_update_indexes_of_pages_domains_add_usage_domain_wildcard_remove_domain.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class UpdateIndexesOfPagesDomainsAddUsageDomainWildcardRemoveDomain < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :pages_domains, :usage
+ add_concurrent_index :pages_domains, [:domain, :wildcard], unique: true
+ remove_concurrent_index :pages_domains, :domain
+ end
+
+ def down
+ remove_concurrent_index :pages_domains, :usage
+ remove_concurrent_index :pages_domains, [:domain, :wildcard]
+ add_concurrent_index :pages_domains, :domain, unique: true
+ end
+end
diff --git a/db/migrate/20200129035446_rename_pages_domains_domain_type_to_scope.rb b/db/migrate/20200129035446_rename_pages_domains_domain_type_to_scope.rb
new file mode 100644
index 00000000000..74d9827e370
--- /dev/null
+++ b/db/migrate/20200129035446_rename_pages_domains_domain_type_to_scope.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class RenamePagesDomainsDomainTypeToScope < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ rename_column_concurrently :pages_domains, :domain_type, :scope
+ end
+
+ def down
+ undo_rename_column_concurrently :pages_domains, :domain_type, :scope
+ end
+end
diff --git a/db/post_migrate/20200129035708_cleanup_rename_pages_domains_domain_type_to_scope.rb b/db/post_migrate/20200129035708_cleanup_rename_pages_domains_domain_type_to_scope.rb
new file mode 100644
index 00000000000..d1d2b4962dd
--- /dev/null
+++ b/db/post_migrate/20200129035708_cleanup_rename_pages_domains_domain_type_to_scope.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class CleanupRenamePagesDomainsDomainTypeToScope < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ cleanup_concurrent_column_rename :pages_domains, :domain_type, :scope
+ end
+
+ def down
+ undo_cleanup_concurrent_column_rename :pages_domains, :domain_type, :scope
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 70e93a63148..98f127020de 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2020_01_27_090233) do
+ActiveRecord::Schema.define(version: 2020_01_29_035708) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
@@ -3018,13 +3018,15 @@ ActiveRecord::Schema.define(version: 2020_01_27_090233) do
t.datetime_with_timezone "certificate_valid_not_after"
t.integer "certificate_source", limit: 2, default: 0, null: false
t.boolean "wildcard", default: false, null: false
- t.integer "domain_type", limit: 2, default: 2, null: false
+ t.integer "usage", limit: 2, default: 0, null: false
+ t.integer "scope", limit: 2, default: 2, null: false
t.index ["certificate_source", "certificate_valid_not_after"], name: "index_pages_domains_need_auto_ssl_renewal", where: "(auto_ssl_enabled = true)"
- t.index ["domain"], name: "index_pages_domains_on_domain", unique: true
- t.index ["domain_type"], name: "index_pages_domains_on_domain_type"
+ 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"
t.index ["project_id"], name: "index_pages_domains_on_project_id"
t.index ["remove_at"], name: "index_pages_domains_on_remove_at"
+ t.index ["scope"], name: "index_pages_domains_on_scope"
+ t.index ["usage"], name: "index_pages_domains_on_usage"
t.index ["verified_at", "enabled_until"], name: "index_pages_domains_on_verified_at_and_enabled_until"
t.index ["verified_at"], name: "index_pages_domains_on_verified_at"
t.index ["wildcard"], name: "index_pages_domains_on_wildcard"