summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20180209115333_create_chatops_tables.rb26
-rw-r--r--db/migrate/20181027114222_add_first_day_of_week_to_user_preferences.rb2
-rw-r--r--db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb2
-rw-r--r--db/migrate/20190107151020_add_services_type_index.rb20
-rw-r--r--db/migrate/20190107151029_remove_hipchat_services.rb16
-rw-r--r--db/migrate/limits_to_mysql.rb13
6 files changed, 64 insertions, 15 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/20181027114222_add_first_day_of_week_to_user_preferences.rb b/db/migrate/20181027114222_add_first_day_of_week_to_user_preferences.rb
index a0e76c2186e..96ba5fbd816 100644
--- a/db/migrate/20181027114222_add_first_day_of_week_to_user_preferences.rb
+++ b/db/migrate/20181027114222_add_first_day_of_week_to_user_preferences.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class AddFirstDayOfWeekToUserPreferences < ActiveRecord::Migration
+class AddFirstDayOfWeekToUserPreferences < ActiveRecord::Migration[5.0]
DOWNTIME = false
def change
diff --git a/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb b/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb
index 53cfaa289f6..e9a8c1011ad 100644
--- a/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb
+++ b/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class AddFirstDayOfWeekToApplicationSettings < ActiveRecord::Migration
+class AddFirstDayOfWeekToApplicationSettings < ActiveRecord::Migration[5.0]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
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