diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-10-10 09:05:53 +0100 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-10-10 09:05:53 +0100 |
commit | abdfe58503d26137ee0cb3cc17dcbdedcb93d57c (patch) | |
tree | 4f1132f9aa61d5ecb53ebe7fe16b531e5968b232 /db/migrate | |
parent | 058381b6a5a331a85389d12e032117621bab19cc (diff) | |
parent | 43b692cb4b43a476862fb6e7bf4c09edd6035077 (diff) | |
download | gitlab-ce-38869-ci-global.tar.gz |
Merge branch 'master' into 38869-ci-global38869-ci-global
* master: (116 commits)
Fix bad type checking to prevent 0 count badge to be shown
fix incorrect description for advanced settings section of project settings
Introduce new hook data builders for Issue and MergeRequest
Don't create todos for old issue assignees
Start adding Gitlab::HookData::IssuableBuilder
Include the changes in issuable webhook payloads
Rename the `codeclimate` job to `codequality`
Don't show an "Unsubscribe" link in snippet comment notifications
Add QA::Scenario::Gitlab::Group::Create
Removes CommitsList from global namespace
Fix wiki empty page translation namespace not being removed
Fixes mini graph in commit view
Fix link to new i18n index page
Update i18n docs
Move i18n/introduction to i18n/index
Resolve "Simple documentation update - backup to restore in restore section"
Remove AjaxLoadingSpinner and CreateLabelDropdown from global namespace
Move cycle analytics banner into a vue file
Updated Icons + Fix for Collapsed Groups Angle
Don't create fork networks for root projects that are deleted
...
Diffstat (limited to 'db/migrate')
7 files changed, 152 insertions, 0 deletions
diff --git a/db/migrate/20170928124105_create_fork_networks.rb b/db/migrate/20170928124105_create_fork_networks.rb new file mode 100644 index 00000000000..ca906b953a3 --- /dev/null +++ b/db/migrate/20170928124105_create_fork_networks.rb @@ -0,0 +1,28 @@ +class CreateForkNetworks < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + create_table :fork_networks do |t| + t.references :root_project, + references: :projects, + index: { unique: true } + + t.string :deleted_root_project_name + end + + add_concurrent_foreign_key :fork_networks, :projects, + column: :root_project_id, + on_delete: :nullify + end + + def down + if foreign_keys_for(:fork_networks, :root_project_id).any? + remove_foreign_key :fork_networks, column: :root_project_id + end + drop_table :fork_networks + end +end diff --git a/db/migrate/20170928133643_create_fork_network_members.rb b/db/migrate/20170928133643_create_fork_network_members.rb new file mode 100644 index 00000000000..836f023efdc --- /dev/null +++ b/db/migrate/20170928133643_create_fork_network_members.rb @@ -0,0 +1,26 @@ +class CreateForkNetworkMembers < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + create_table :fork_network_members do |t| + t.references :fork_network, null: false, index: true, foreign_key: { on_delete: :cascade } + t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } + t.references :forked_from_project, references: :projects + end + + add_concurrent_foreign_key :fork_network_members, :projects, + column: :forked_from_project_id, + on_delete: :nullify + end + + def down + if foreign_keys_for(:fork_network_members, :forked_from_project_id).any? + remove_foreign_key :fork_network_members, column: :forked_from_project_id + end + drop_table :fork_network_members + end +end diff --git a/db/migrate/20170929131201_populate_fork_networks.rb b/db/migrate/20170929131201_populate_fork_networks.rb new file mode 100644 index 00000000000..1214962770f --- /dev/null +++ b/db/migrate/20170929131201_populate_fork_networks.rb @@ -0,0 +1,30 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class PopulateForkNetworks < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + MIGRATION = 'PopulateForkNetworksRange'.freeze + BATCH_SIZE = 100 + DELAY_INTERVAL = 15.seconds + + disable_ddl_transaction! + + class ForkedProjectLink < ActiveRecord::Base + include EachBatch + + self.table_name = 'forked_project_links' + end + + def up + say 'Populating the `fork_networks` based on existing `forked_project_links`' + + queue_background_migration_jobs_by_range_at_intervals(ForkedProjectLink, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE) + end + + def down + # nothing + end +end diff --git a/db/migrate/20171006090001_create_ci_build_trace_sections.rb b/db/migrate/20171006090001_create_ci_build_trace_sections.rb new file mode 100644 index 00000000000..ab5ef319618 --- /dev/null +++ b/db/migrate/20171006090001_create_ci_build_trace_sections.rb @@ -0,0 +1,19 @@ +class CreateCiBuildTraceSections < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :ci_build_trace_sections do |t| + t.references :project, null: false, index: true, foreign_key: { on_delete: :cascade } + t.datetime_with_timezone :date_start, null: false + t.datetime_with_timezone :date_end, null: false + t.integer :byte_start, limit: 8, null: false + t.integer :byte_end, limit: 8, null: false + t.integer :build_id, null: false + t.integer :section_name_id, null: false + end + + add_index :ci_build_trace_sections, [:build_id, :section_name_id], unique: true + end +end diff --git a/db/migrate/20171006090010_add_build_foreign_key_to_ci_build_trace_sections.rb b/db/migrate/20171006090010_add_build_foreign_key_to_ci_build_trace_sections.rb new file mode 100644 index 00000000000..d279463eb4b --- /dev/null +++ b/db/migrate/20171006090010_add_build_foreign_key_to_ci_build_trace_sections.rb @@ -0,0 +1,15 @@ +class AddBuildForeignKeyToCiBuildTraceSections < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key(:ci_build_trace_sections, :ci_builds, column: :build_id) + end + + def down + remove_foreign_key(:ci_build_trace_sections, column: :build_id) + end +end diff --git a/db/migrate/20171006090100_create_ci_build_trace_section_names.rb b/db/migrate/20171006090100_create_ci_build_trace_section_names.rb new file mode 100644 index 00000000000..88f3e60699a --- /dev/null +++ b/db/migrate/20171006090100_create_ci_build_trace_section_names.rb @@ -0,0 +1,19 @@ +class CreateCiBuildTraceSectionNames < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + create_table :ci_build_trace_section_names do |t| + t.references :project, null: false, foreign_key: { on_delete: :cascade } + t.string :name, null: false + end + + add_index :ci_build_trace_section_names, [:project_id, :name], unique: true + end + + def down + remove_foreign_key :ci_build_trace_section_names, column: :project_id + drop_table :ci_build_trace_section_names + end +end diff --git a/db/migrate/20171006091000_add_name_foreign_key_to_ci_build_trace_sections.rb b/db/migrate/20171006091000_add_name_foreign_key_to_ci_build_trace_sections.rb new file mode 100644 index 00000000000..08422885a98 --- /dev/null +++ b/db/migrate/20171006091000_add_name_foreign_key_to_ci_build_trace_sections.rb @@ -0,0 +1,15 @@ +class AddNameForeignKeyToCiBuildTraceSections < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key(:ci_build_trace_sections, :ci_build_trace_section_names, column: :section_name_id) + end + + def down + remove_foreign_key(:ci_build_trace_sections, column: :section_name_id) + end +end |