diff options
author | Felipe Artur <felipefac@gmail.com> | 2019-02-19 11:35:29 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2019-02-19 11:35:29 -0300 |
commit | 648b87315d12d18c92ea14b14ae827480ab3093a (patch) | |
tree | 8c6bab95481bec1c65f0af2fece58b000c3396b7 /db | |
parent | 52155d8cf8374e9184c2ae834cab761b7520db93 (diff) | |
parent | 0aa64cf80ccd7fda10641af0cd43c4c0a7f3e133 (diff) | |
download | gitlab-ce-648b87315d12d18c92ea14b14ae827480ab3093a.tar.gz |
Merge branch 'master' into issue_51789_part_1
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20180209115333_create_chatops_tables.rb | 26 | ||||
-rw-r--r-- | db/migrate/20190107151020_add_services_type_index.rb | 20 | ||||
-rw-r--r-- | db/migrate/20190107151029_remove_hipchat_services.rb | 16 | ||||
-rw-r--r-- | db/migrate/limits_to_mysql.rb | 13 | ||||
-rw-r--r-- | db/schema.rb | 11 |
5 files changed, 73 insertions, 13 deletions
diff --git a/db/migrate/20180209115333_create_chatops_tables.rb b/db/migrate/20180209115333_create_chatops_tables.rb new file mode 100644 index 00000000000..2cfb71e1007 --- /dev/null +++ b/db/migrate/20180209115333_create_chatops_tables.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class CreateChatopsTables < ActiveRecord::Migration[4.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :ci_pipeline_chat_data, id: :bigserial do |t| + t.integer :pipeline_id, null: false + t.references :chat_name, foreign_key: { on_delete: :cascade }, null: false + t.text :response_url, null: false + + # A pipeline can only contain one row in this table, hence this index is + # unique. + t.index :pipeline_id, unique: true + + t.index :chat_name_id + end + + # rubocop:disable Migration/AddConcurrentForeignKey + add_foreign_key :ci_pipeline_chat_data, :ci_pipelines, + column: :pipeline_id, + on_delete: :cascade + end +end diff --git a/db/migrate/20190107151020_add_services_type_index.rb b/db/migrate/20190107151020_add_services_type_index.rb new file mode 100644 index 00000000000..26b5bd58750 --- /dev/null +++ b/db/migrate/20190107151020_add_services_type_index.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddServicesTypeIndex < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :services, :type unless index_exists?(:services, :type) + end + + def down + remove_concurrent_index :services, :type if index_exists?(:services, :type) + end +end diff --git a/db/migrate/20190107151029_remove_hipchat_services.rb b/db/migrate/20190107151029_remove_hipchat_services.rb new file mode 100644 index 00000000000..4741ec88907 --- /dev/null +++ b/db/migrate/20190107151029_remove_hipchat_services.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class RemoveHipchatServices < ActiveRecord::Migration[5.0] + DOWNTIME = false + + def up + execute "DELETE FROM services WHERE type = 'HipchatService'" + end + + def down + # no-op + end +end diff --git a/db/migrate/limits_to_mysql.rb b/db/migrate/limits_to_mysql.rb index 87992b541b1..33cb19aff9e 100644 --- a/db/migrate/limits_to_mysql.rb +++ b/db/migrate/limits_to_mysql.rb @@ -2,19 +2,6 @@ class LimitsToMysql < ActiveRecord::Migration[4.2] def up return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/ - # These columns were removed in 10.3, but this is called from two places: - # 1. A migration run after they were added, but before they were removed. - # 2. A rake task which can be run at any time. - # - # Because of item 2, we need these checks. - if column_exists?(:merge_request_diffs, :st_commits) - change_column :merge_request_diffs, :st_commits, :text, limit: 2147483647 - end - - if column_exists?(:merge_request_diffs, :st_diffs) - change_column :merge_request_diffs, :st_diffs, :text, limit: 2147483647 - end - change_column :snippets, :content, :text, limit: 2147483647 change_column :notes, :st_diff, :text, limit: 2147483647 end diff --git a/db/schema.rb b/db/schema.rb index 4a347e7289b..626d8ed9646 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -421,6 +421,14 @@ ActiveRecord::Schema.define(version: 20190214112022) do t.index ["project_id"], name: "index_ci_job_artifacts_on_project_id", using: :btree end + create_table "ci_pipeline_chat_data", id: :bigserial, force: :cascade do |t| + t.integer "pipeline_id", null: false + t.integer "chat_name_id", null: false + t.text "response_url", null: false + t.index ["chat_name_id"], name: "index_ci_pipeline_chat_data_on_chat_name_id", using: :btree + t.index ["pipeline_id"], name: "index_ci_pipeline_chat_data_on_pipeline_id", unique: true, using: :btree + end + create_table "ci_pipeline_schedule_variables", force: :cascade do |t| t.string "key", null: false t.text "value" @@ -1938,6 +1946,7 @@ ActiveRecord::Schema.define(version: 20190214112022) do t.boolean "confidential_note_events", default: true t.index ["project_id"], name: "index_services_on_project_id", using: :btree t.index ["template"], name: "index_services_on_template", using: :btree + t.index ["type"], name: "index_services_on_type", using: :btree end create_table "shards", force: :cascade do |t| @@ -2346,6 +2355,8 @@ ActiveRecord::Schema.define(version: 20190214112022) do add_foreign_key "ci_group_variables", "namespaces", column: "group_id", name: "fk_33ae4d58d8", on_delete: :cascade add_foreign_key "ci_job_artifacts", "ci_builds", column: "job_id", on_delete: :cascade add_foreign_key "ci_job_artifacts", "projects", on_delete: :cascade + add_foreign_key "ci_pipeline_chat_data", "chat_names", on_delete: :cascade + add_foreign_key "ci_pipeline_chat_data", "ci_pipelines", column: "pipeline_id", on_delete: :cascade add_foreign_key "ci_pipeline_schedule_variables", "ci_pipeline_schedules", column: "pipeline_schedule_id", name: "fk_41c35fda51", on_delete: :cascade add_foreign_key "ci_pipeline_schedules", "projects", name: "fk_8ead60fcc4", on_delete: :cascade add_foreign_key "ci_pipeline_schedules", "users", column: "owner_id", name: "fk_9ea99f58d2", on_delete: :nullify |