Commit be33ee25 authored by Alishan Ladhani's avatar Alishan Ladhani

Add wildcard and domain_type to pages_domains

In preparation for serverless domain support. All serverless domains
are required to be wildcard domains, and will not work with the existing
LetsEncrypt verification process.

A serverless domain can be configured on instance, group, or project
levels, so domain_type will store what level it is configured on.
parent 5f7bd5b1
......@@ -6,6 +6,7 @@ class PagesDomain < ApplicationRecord
SSL_RENEWAL_THRESHOLD = 30.days.freeze
enum certificate_source: { user_provided: 0, gitlab_provided: 1 }, _prefix: :certificate
enum domain_type: { instance: 0, group: 1, project: 2 }, _prefix: :domain_type
belongs_to :project
has_many :acme_orders, class_name: "PagesDomainAcmeOrder"
......
# frozen_string_literal: true
class AddWildcardAndDomainTypeToPagesDomains < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
PROJECT_TYPE = 2
disable_ddl_transaction!
def up
add_column_with_default :pages_domains, :wildcard, :boolean, default: false
add_column_with_default :pages_domains, :domain_type, :integer, limit: 2, default: PROJECT_TYPE
end
def down
remove_column :pages_domains, :wildcard
remove_column :pages_domains, :domain_type
end
end
# frozen_string_literal: true
class AddIndexesToPagesDomainsOnWildcardAndDomainType < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :pages_domains, :wildcard
add_concurrent_index :pages_domains, :domain_type
end
def down
remove_concurrent_index :pages_domains, :wildcard
remove_concurrent_index :pages_domains, :domain_type
end
end
......@@ -2929,13 +2929,17 @@ ActiveRecord::Schema.define(version: 2019_12_08_071112) do
t.datetime_with_timezone "certificate_valid_not_before"
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.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 ["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 ["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"
end
create_table "path_locks", id: :serial, force: :cascade do |t|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment