Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-20 12:24:38 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-20 12:24:38 +0300
commit898e2cc1dfa88b4ac39cb4b35011f61b37f57b51 (patch)
treec6524edb6c9a43cccf93be05c36883fde1a53ee4 /db
parentb5571e6e22cdacc81f78eff5943d68c8ba220fbb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/10_merge_requests.rb2
-rw-r--r--db/fixtures/development/17_cycle_analytics.rb2
-rw-r--r--db/migrate/20191213120427_fix_max_pages_size.rb20
-rw-r--r--db/post_migrate/20191218225624_add_index_on_project_id_to_ci_pipelines.rb18
-rw-r--r--db/schema.rb3
5 files changed, 42 insertions, 3 deletions
diff --git a/db/fixtures/development/10_merge_requests.rb b/db/fixtures/development/10_merge_requests.rb
index 77650ebb1bc..9157045a7fd 100644
--- a/db/fixtures/development/10_merge_requests.rb
+++ b/db/fixtures/development/10_merge_requests.rb
@@ -47,7 +47,7 @@ Gitlab::Seeder.quiet do
project = Project.find_by_full_path('gitlab-org/gitlab-test')
- next if project.empty_repo? # We don't have repository on CI
+ next if !project || project.empty_repo? # We don't have repository on CI
params = {
source_branch: 'feature',
diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb
index 2532b71ad26..3e017b810b6 100644
--- a/db/fixtures/development/17_cycle_analytics.rb
+++ b/db/fixtures/development/17_cycle_analytics.rb
@@ -5,7 +5,7 @@ class Gitlab::Seeder::CycleAnalytics
def initialize(project, perf: false)
@project = project
@user = User.admins.first
- @issue_count = perf ? 1000 : 5
+ @issue_count = perf ? 1000 : ENV.fetch('CYCLE_ANALYTICS_ISSUE_COUNT', 5).to_i
end
def seed_metrics!
diff --git a/db/migrate/20191213120427_fix_max_pages_size.rb b/db/migrate/20191213120427_fix_max_pages_size.rb
new file mode 100644
index 00000000000..498ea91b773
--- /dev/null
+++ b/db/migrate/20191213120427_fix_max_pages_size.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class FixMaxPagesSize < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+ MAX_SIZE = 1.terabyte / 1.megabyte
+
+ class ApplicationSetting < ActiveRecord::Base
+ self.table_name = 'application_settings'
+ self.inheritance_column = :_type_disabled
+ end
+
+ def up
+ table = ApplicationSetting.arel_table
+ ApplicationSetting.where(table[:max_pages_size].gt(MAX_SIZE)).update_all(max_pages_size: MAX_SIZE)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20191218225624_add_index_on_project_id_to_ci_pipelines.rb b/db/post_migrate/20191218225624_add_index_on_project_id_to_ci_pipelines.rb
new file mode 100644
index 00000000000..ab6c3b0616a
--- /dev/null
+++ b/db/post_migrate/20191218225624_add_index_on_project_id_to_ci_pipelines.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexOnProjectIdToCiPipelines < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_ci_pipelines_on_project_id_and_id_desc'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_pipelines, [:project_id, :id], name: INDEX_NAME, order: { id: :desc }
+ end
+
+ def down
+ remove_concurrent_index :ci_pipelines, [:project_id, :id], name: INDEX_NAME, order: { id: :desc }
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 91fbcd42f30..dee28ea4287 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: 2019_12_16_183532) do
+ActiveRecord::Schema.define(version: 2019_12_18_225624) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
@@ -863,6 +863,7 @@ ActiveRecord::Schema.define(version: 2019_12_16_183532) do
t.index ["external_pull_request_id"], name: "index_ci_pipelines_on_external_pull_request_id", where: "(external_pull_request_id IS NOT NULL)"
t.index ["merge_request_id"], name: "index_ci_pipelines_on_merge_request_id", where: "(merge_request_id IS NOT NULL)"
t.index ["pipeline_schedule_id"], name: "index_ci_pipelines_on_pipeline_schedule_id"
+ t.index ["project_id", "id"], name: "index_ci_pipelines_on_project_id_and_id_desc", order: { id: :desc }
t.index ["project_id", "iid"], name: "index_ci_pipelines_on_project_id_and_iid", unique: true, where: "(iid IS NOT NULL)"
t.index ["project_id", "ref", "id"], name: "index_ci_pipelines_on_project_idandrefandiddesc", order: { id: :desc }
t.index ["project_id", "ref", "status", "id"], name: "index_ci_pipelines_on_project_id_and_ref_and_status_and_id"