summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 15:06:26 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 15:06:26 +0000
commit84727c8209a4412e21111a07f99b0438b03232de (patch)
tree1fcfa02b01548c3cdc561186870a1c807f227f0b /db
parentd2798d607e11e0ebae83ae909404834388733428 (diff)
downloadgitlab-ce-84727c8209a4412e21111a07f99b0438b03232de.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb35
-rw-r--r--db/post_migrate/20190904205212_remove_id_column_from_intermediate_release_milestones.rb9
-rw-r--r--db/schema.rb16
3 files changed, 59 insertions, 1 deletions
diff --git a/db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb b/db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb
new file mode 100644
index 00000000000..07da4c20d55
--- /dev/null
+++ b/db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class CreateAnalyticsLanguageTrendRepositoryLanguages < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+ INDEX_PREFIX = 'analytics_repository_languages_'
+
+ def change
+ create_table :analytics_language_trend_repository_languages, id: false do |t|
+ t.integer :file_count, null: false, default: 0
+ t.references :programming_language, {
+ null: false,
+ foreign_key: { on_delete: :cascade },
+ index: false
+ }
+ t.references :project, {
+ null: false,
+ foreign_key: { on_delete: :cascade },
+ index: { name: INDEX_PREFIX + 'on_project_id' }
+ }
+ t.integer :loc, null: false, default: 0
+ t.integer :bytes, null: false, default: 0
+ # Storing percentage (with 2 decimal places), on 2 bytes.
+ # 50.25% => 5025
+ # Max: 100.00% => 10000 (fits smallint: 32767)
+ t.integer :percentage, limit: 2, null: false, default: 0
+ t.date :snapshot_date, null: false
+ end
+
+ add_index :analytics_language_trend_repository_languages, %I[
+ programming_language_id
+ project_id
+ snapshot_date
+ ], name: INDEX_PREFIX + 'unique_index', unique: true
+ end
+end
diff --git a/db/post_migrate/20190904205212_remove_id_column_from_intermediate_release_milestones.rb b/db/post_migrate/20190904205212_remove_id_column_from_intermediate_release_milestones.rb
new file mode 100644
index 00000000000..e4b65d26db6
--- /dev/null
+++ b/db/post_migrate/20190904205212_remove_id_column_from_intermediate_release_milestones.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class RemoveIdColumnFromIntermediateReleaseMilestones < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ remove_column :milestone_releases, :id, :bigint
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index b43779f4126..1460a8b11e8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -81,6 +81,18 @@ ActiveRecord::Schema.define(version: 2019_09_12_061145) do
t.index ["start_event_label_id"], name: "index_analytics_ca_project_stages_on_start_event_label_id"
end
+ create_table "analytics_language_trend_repository_languages", id: false, force: :cascade do |t|
+ t.integer "file_count", default: 0, null: false
+ t.bigint "programming_language_id", null: false
+ t.bigint "project_id", null: false
+ t.integer "loc", default: 0, null: false
+ t.integer "bytes", default: 0, null: false
+ t.integer "percentage", limit: 2, default: 0, null: false
+ t.date "snapshot_date", null: false
+ t.index ["programming_language_id", "project_id", "snapshot_date"], name: "analytics_repository_languages_unique_index", unique: true
+ t.index ["project_id"], name: "analytics_repository_languages_on_project_id"
+ end
+
create_table "appearances", id: :serial, force: :cascade do |t|
t.string "title", null: false
t.text "description", null: false
@@ -2196,7 +2208,7 @@ ActiveRecord::Schema.define(version: 2019_09_12_061145) do
t.index ["user_id"], name: "index_merge_trains_on_user_id"
end
- create_table "milestone_releases", force: :cascade do |t|
+ create_table "milestone_releases", id: false, force: :cascade do |t|
t.bigint "milestone_id", null: false
t.bigint "release_id", null: false
t.index ["milestone_id", "release_id"], name: "index_miletone_releases_on_milestone_and_release", unique: true
@@ -3762,6 +3774,8 @@ ActiveRecord::Schema.define(version: 2019_09_12_061145) do
add_foreign_key "analytics_cycle_analytics_project_stages", "labels", column: "end_event_label_id", on_delete: :cascade
add_foreign_key "analytics_cycle_analytics_project_stages", "labels", column: "start_event_label_id", on_delete: :cascade
add_foreign_key "analytics_cycle_analytics_project_stages", "projects", on_delete: :cascade
+ add_foreign_key "analytics_language_trend_repository_languages", "programming_languages", on_delete: :cascade
+ add_foreign_key "analytics_language_trend_repository_languages", "projects", on_delete: :cascade
add_foreign_key "application_settings", "namespaces", column: "custom_project_templates_group_id", on_delete: :nullify
add_foreign_key "application_settings", "projects", column: "file_template_project_id", name: "fk_ec757bd087", on_delete: :nullify
add_foreign_key "application_settings", "projects", column: "instance_administration_project_id", on_delete: :nullify