summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200219135440_add_limit_metric_type_to_list.rb9
-rw-r--r--db/migrate/20200302152516_add_wiki_slug.rb22
-rw-r--r--db/migrate/20200316111759_add_index_on_id_and_ldap_key_to_keys.rb18
-rw-r--r--db/schema.rb25
4 files changed, 73 insertions, 1 deletions
diff --git a/db/migrate/20200219135440_add_limit_metric_type_to_list.rb b/db/migrate/20200219135440_add_limit_metric_type_to_list.rb
new file mode 100644
index 00000000000..35e36b4805b
--- /dev/null
+++ b/db/migrate/20200219135440_add_limit_metric_type_to_list.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddLimitMetricTypeToList < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :lists, :limit_metric, :string, limit: 20
+ end
+end
diff --git a/db/migrate/20200302152516_add_wiki_slug.rb b/db/migrate/20200302152516_add_wiki_slug.rb
new file mode 100644
index 00000000000..dabac39aeb8
--- /dev/null
+++ b/db/migrate/20200302152516_add_wiki_slug.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddWikiSlug < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ create_table :wiki_page_meta, id: :serial do |t|
+ t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: false
+ t.timestamps_with_timezone null: false
+ t.string :title, null: false, limit: 255
+ end
+
+ create_table :wiki_page_slugs, id: :serial do |t|
+ t.boolean :canonical, default: false, null: false
+ t.references :wiki_page_meta, index: true, foreign_key: { on_delete: :cascade }, null: false
+ t.timestamps_with_timezone null: false
+ t.string :slug, null: false, limit: 2048
+ t.index [:slug, :wiki_page_meta_id], unique: true
+ t.index [:wiki_page_meta_id], name: 'one_canonical_wiki_page_slug_per_metadata', unique: true, where: "(canonical = true)"
+ end
+ end
+end
diff --git a/db/migrate/20200316111759_add_index_on_id_and_ldap_key_to_keys.rb b/db/migrate/20200316111759_add_index_on_id_and_ldap_key_to_keys.rb
new file mode 100644
index 00000000000..23e7b5ba7b9
--- /dev/null
+++ b/db/migrate/20200316111759_add_index_on_id_and_ldap_key_to_keys.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexOnIdAndLdapKeyToKeys < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_keys_on_id_and_ldap_key_type'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :keys, [:id], where: "type = 'LDAPKey'", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :keys, INDEX_NAME
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index aed7285e698..69ef887bfe5 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_03_13_123934) do
+ActiveRecord::Schema.define(version: 2020_03_16_111759) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
@@ -2311,6 +2311,7 @@ ActiveRecord::Schema.define(version: 2020_03_13_123934) do
t.index ["fingerprint"], name: "index_keys_on_fingerprint", unique: true
t.index ["fingerprint_sha256"], name: "index_keys_on_fingerprint_sha256"
t.index ["id", "type"], name: "index_on_deploy_keys_id_and_type_and_public", unique: true, where: "(public = true)"
+ t.index ["id"], name: "index_keys_on_id_and_ldap_key_type", where: "((type)::text = 'LDAPKey'::text)"
t.index ["last_used_at"], name: "index_keys_on_last_used_at", order: "DESC NULLS LAST"
t.index ["user_id"], name: "index_keys_on_user_id"
end
@@ -2425,6 +2426,7 @@ ActiveRecord::Schema.define(version: 2020_03_13_123934) do
t.integer "milestone_id"
t.integer "max_issue_count", default: 0, null: false
t.integer "max_issue_weight", default: 0, null: false
+ t.string "limit_metric", limit: 20
t.index ["board_id", "label_id"], name: "index_lists_on_board_id_and_label_id", unique: true
t.index ["label_id"], name: "index_lists_on_label_id"
t.index ["list_type"], name: "index_lists_on_list_type"
@@ -4668,6 +4670,25 @@ ActiveRecord::Schema.define(version: 2020_03_13_123934) do
t.index ["type"], name: "index_web_hooks_on_type"
end
+ create_table "wiki_page_meta", id: :serial, force: :cascade do |t|
+ t.bigint "project_id", null: false
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.string "title", limit: 255, null: false
+ t.index ["project_id"], name: "index_wiki_page_meta_on_project_id"
+ end
+
+ create_table "wiki_page_slugs", id: :serial, force: :cascade do |t|
+ t.boolean "canonical", default: false, null: false
+ t.bigint "wiki_page_meta_id", null: false
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.string "slug", limit: 2048, null: false
+ t.index ["slug", "wiki_page_meta_id"], name: "index_wiki_page_slugs_on_slug_and_wiki_page_meta_id", unique: true
+ t.index ["wiki_page_meta_id"], name: "index_wiki_page_slugs_on_wiki_page_meta_id"
+ t.index ["wiki_page_meta_id"], name: "one_canonical_wiki_page_slug_per_metadata", unique: true, where: "(canonical = true)"
+ end
+
create_table "x509_certificates", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
@@ -5212,6 +5233,8 @@ ActiveRecord::Schema.define(version: 2020_03_13_123934) do
add_foreign_key "vulnerability_scanners", "projects", on_delete: :cascade
add_foreign_key "web_hook_logs", "web_hooks", on_delete: :cascade
add_foreign_key "web_hooks", "projects", name: "fk_0c8ca6d9d1", on_delete: :cascade
+ add_foreign_key "wiki_page_meta", "projects", on_delete: :cascade
+ add_foreign_key "wiki_page_slugs", "wiki_page_meta", column: "wiki_page_meta_id", on_delete: :cascade
add_foreign_key "x509_certificates", "x509_issuers", on_delete: :cascade
add_foreign_key "x509_commit_signatures", "projects", on_delete: :cascade
add_foreign_key "x509_commit_signatures", "x509_certificates", on_delete: :cascade