diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-09-06 21:06:55 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-09-06 21:06:55 +0000 |
commit | 915306ec50c50b3b1b0793150a7cb4f31fbbee75 (patch) | |
tree | c9f6a045ee02003ca9b715783692cb1d623f619d /db | |
parent | c353773787407158b6319b6944dee57a6e3522b9 (diff) | |
parent | 7aa6766cd15036dcfb5391b3fd7bffb9069ffbcf (diff) | |
download | gitlab-ce-915306ec50c50b3b1b0793150a7cb4f31fbbee75.tar.gz |
Merge branch 'master' into 'alerts-for-built-in-metrics'
# Conflicts:
# db/schema.rb
Diffstat (limited to 'db')
8 files changed, 109 insertions, 3 deletions
diff --git a/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb b/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb new file mode 100644 index 00000000000..6a69460e611 --- /dev/null +++ b/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb @@ -0,0 +1,12 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddPushEventsBranchFilterToWebHooks < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :web_hooks, :push_events_branch_filter, :text + end +end diff --git a/db/migrate/20180815040323_add_authorization_type_to_cluster_platforms_kubernetes.rb b/db/migrate/20180815040323_add_authorization_type_to_cluster_platforms_kubernetes.rb new file mode 100644 index 00000000000..6397d6dd99f --- /dev/null +++ b/db/migrate/20180815040323_add_authorization_type_to_cluster_platforms_kubernetes.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddAuthorizationTypeToClusterPlatformsKubernetes < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :cluster_platforms_kubernetes, :authorization_type, :integer, limit: 2 + end +end diff --git a/db/migrate/20180815160409_add_file_location_to_ci_job_artifacts.rb b/db/migrate/20180815160409_add_file_location_to_ci_job_artifacts.rb new file mode 100644 index 00000000000..620342005fe --- /dev/null +++ b/db/migrate/20180815160409_add_file_location_to_ci_job_artifacts.rb @@ -0,0 +1,9 @@ +class AddFileLocationToCiJobArtifacts < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :ci_job_artifacts, :file_location, :integer, limit: 2 + end +end diff --git a/db/migrate/20180815170510_add_partial_index_to_ci_builds_artifacts_file.rb b/db/migrate/20180815170510_add_partial_index_to_ci_builds_artifacts_file.rb new file mode 100644 index 00000000000..5e041ea6559 --- /dev/null +++ b/db/migrate/20180815170510_add_partial_index_to_ci_builds_artifacts_file.rb @@ -0,0 +1,16 @@ +class AddPartialIndexToCiBuildsArtifactsFile < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'partial_index_ci_builds_on_id_with_legacy_artifacts'.freeze + + disable_ddl_transaction! + + def up + add_concurrent_index(:ci_builds, :id, where: "artifacts_file <> ''", name: INDEX_NAME) + end + + def down + remove_concurrent_index_by_name(:ci_builds, INDEX_NAME) + end +end diff --git a/db/migrate/20180901171833_add_project_config_source_status_index_to_pipeline.rb b/db/migrate/20180901171833_add_project_config_source_status_index_to_pipeline.rb new file mode 100644 index 00000000000..99dfcc94b12 --- /dev/null +++ b/db/migrate/20180901171833_add_project_config_source_status_index_to_pipeline.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddProjectConfigSourceStatusIndexToPipeline < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :ci_pipelines, [:project_id, :status, :config_source] + end + + def down + remove_concurrent_index :ci_pipelines, [:project_id, :status, :config_source] + end +end diff --git a/db/post_migrate/20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb b/db/post_migrate/20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb new file mode 100644 index 00000000000..2dd711e9c10 --- /dev/null +++ b/db/post_migrate/20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb @@ -0,0 +1,32 @@ +class MigrateLegacyArtifactsToJobArtifacts < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + MIGRATION = 'MigrateLegacyArtifacts'.freeze + BATCH_SIZE = 100 + + disable_ddl_transaction! + + class Build < ActiveRecord::Base + include EachBatch + + self.table_name = 'ci_builds' + self.inheritance_column = :_type_disabled + + scope :with_legacy_artifacts, -> { where("artifacts_file <> ''") } + end + + def up + MigrateLegacyArtifactsToJobArtifacts::Build + .with_legacy_artifacts.tap do |relation| + queue_background_migration_jobs_by_range_at_intervals(relation, + MIGRATION, + 5.minutes, + batch_size: BATCH_SIZE) + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20180816193530_rename_login_root_namespaces.rb b/db/post_migrate/20180816193530_rename_login_root_namespaces.rb index 60cec24eed6..b0c1fb98fa8 100644 --- a/db/post_migrate/20180816193530_rename_login_root_namespaces.rb +++ b/db/post_migrate/20180816193530_rename_login_root_namespaces.rb @@ -7,10 +7,14 @@ class RenameLoginRootNamespaces < ActiveRecord::Migration # We're taking over the /login namespace as part of a fix for the Jira integration def up - rename_root_paths 'login' + disable_statement_timeout do + rename_root_paths 'login' + end end def down - revert_renames + disable_statement_timeout do + revert_renames + end end end diff --git a/db/schema.rb b/db/schema.rb index 333b40b34ce..9ffaae207b8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180831164910) do +ActiveRecord::Schema.define(version: 20180901171833) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -342,6 +342,7 @@ ActiveRecord::Schema.define(version: 20180831164910) do add_index "ci_builds", ["commit_id", "status", "type"], name: "index_ci_builds_on_commit_id_and_status_and_type", using: :btree add_index "ci_builds", ["commit_id", "type", "name", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_name_and_ref", using: :btree add_index "ci_builds", ["commit_id", "type", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_ref", using: :btree + add_index "ci_builds", ["id"], name: "partial_index_ci_builds_on_id_with_legacy_artifacts", where: "(artifacts_file <> ''::text)", using: :btree add_index "ci_builds", ["project_id", "id"], name: "index_ci_builds_on_project_id_and_id", using: :btree add_index "ci_builds", ["protected"], name: "index_ci_builds_on_protected", using: :btree add_index "ci_builds", ["runner_id"], name: "index_ci_builds_on_runner_id", using: :btree @@ -397,6 +398,7 @@ ActiveRecord::Schema.define(version: 20180831164910) do t.string "file" t.binary "file_sha256" t.integer "file_format", limit: 2 + t.integer "file_location", limit: 2 end add_index "ci_job_artifacts", ["expire_at", "job_id"], name: "index_ci_job_artifacts_on_expire_at_and_job_id", using: :btree @@ -474,6 +476,7 @@ ActiveRecord::Schema.define(version: 20180831164910) do add_index "ci_pipelines", ["project_id", "iid"], name: "index_ci_pipelines_on_project_id_and_iid", unique: true, where: "(iid IS NOT NULL)", using: :btree add_index "ci_pipelines", ["project_id", "ref", "status", "id"], name: "index_ci_pipelines_on_project_id_and_ref_and_status_and_id", using: :btree add_index "ci_pipelines", ["project_id", "sha"], name: "index_ci_pipelines_on_project_id_and_sha", using: :btree + add_index "ci_pipelines", ["project_id", "status", "config_source"], name: "index_ci_pipelines_on_project_id_and_status_and_config_source", using: :btree add_index "ci_pipelines", ["project_id"], name: "index_ci_pipelines_on_project_id", using: :btree add_index "ci_pipelines", ["status"], name: "index_ci_pipelines_on_status", using: :btree add_index "ci_pipelines", ["user_id"], name: "index_ci_pipelines_on_user_id", using: :btree @@ -586,6 +589,7 @@ ActiveRecord::Schema.define(version: 20180831164910) do t.string "encrypted_password_iv" t.text "encrypted_token" t.string "encrypted_token_iv" + t.integer "authorization_type", limit: 2 end add_index "cluster_platforms_kubernetes", ["cluster_id"], name: "index_cluster_platforms_kubernetes_on_cluster_id", unique: true, using: :btree @@ -2262,6 +2266,7 @@ ActiveRecord::Schema.define(version: 20180831164910) do t.boolean "repository_update_events", default: false, null: false t.boolean "job_events", default: false, null: false t.boolean "confidential_note_events" + t.text "push_events_branch_filter" end add_index "web_hooks", ["project_id"], name: "index_web_hooks_on_project_id", using: :btree |