summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorJasper Maes <jaspermaes.jm@gmail.com>2018-12-15 10:06:56 +0100
committerJasper Maes <jaspermaes.jm@gmail.com>2018-12-16 10:48:41 +0100
commit56296f1edadf2bc5f7741cbb3f97cb41f090aac6 (patch)
tree5a21667acd7d431f155d12227181dcfc6d21cba8 /db
parent8b4602041cf2c4a8738a4796d78720017249249f (diff)
downloadgitlab-ce-56296f1edadf2bc5f7741cbb3f97cb41f090aac6.tar.gz
Remove rails4 specific code
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20160226114608_add_trigram_indexes_for_searching.rb7
-rw-r--r--db/migrate/20161207231620_fixup_environment_name_uniqueness.rb3
-rw-r--r--db/migrate/20161207231626_add_environment_slug.rb3
-rw-r--r--db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb3
-rw-r--r--db/post_migrate/20170324160416_migrate_user_activities_to_users_last_activity_on.rb3
5 files changed, 5 insertions, 14 deletions
diff --git a/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb b/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb
index 82b54c552e0..af8b08c095a 100644
--- a/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb
+++ b/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb
@@ -37,12 +37,7 @@ class AddTrigramIndexesForSearching < ActiveRecord::Migration[4.2]
res = execute("SELECT true AS enabled FROM pg_available_extensions WHERE name = 'pg_trgm' AND installed_version IS NOT NULL;")
row = res.first
- check = if Gitlab.rails5?
- true
- else
- 't'
- end
- row && row['enabled'] == check ? true : false
+ row && row['enabled'] == true
end
def create_trigrams_extension
diff --git a/db/migrate/20161207231620_fixup_environment_name_uniqueness.rb b/db/migrate/20161207231620_fixup_environment_name_uniqueness.rb
index 7cae09021cd..420f0ccb45c 100644
--- a/db/migrate/20161207231620_fixup_environment_name_uniqueness.rb
+++ b/db/migrate/20161207231620_fixup_environment_name_uniqueness.rb
@@ -1,5 +1,4 @@
class FixupEnvironmentNameUniqueness < ActiveRecord::Migration[4.2]
- include Gitlab::Database::ArelMethods
include Gitlab::Database::MigrationHelpers
DOWNTIME = true
@@ -42,7 +41,7 @@ class FixupEnvironmentNameUniqueness < ActiveRecord::Migration[4.2]
conflicts.each do |id, name|
update_sql =
- arel_update_manager
+ Arel::UpdateManager.new
.table(environments)
.set(environments[:name] => name + "-" + id.to_s)
.where(environments[:id].eq(id))
diff --git a/db/migrate/20161207231626_add_environment_slug.rb b/db/migrate/20161207231626_add_environment_slug.rb
index 4657b023dfa..993b9bd3330 100644
--- a/db/migrate/20161207231626_add_environment_slug.rb
+++ b/db/migrate/20161207231626_add_environment_slug.rb
@@ -2,7 +2,6 @@
# for more information on how to write migrations for GitLab.
class AddEnvironmentSlug < ActiveRecord::Migration[4.2]
- include Gitlab::Database::ArelMethods
include Gitlab::Database::MigrationHelpers
DOWNTIME = true
@@ -20,7 +19,7 @@ class AddEnvironmentSlug < ActiveRecord::Migration[4.2]
finder = environments.project(:id, :name)
connection.exec_query(finder.to_sql).rows.each do |id, name|
- updater = arel_update_manager
+ updater = Arel::UpdateManager.new
.table(environments)
.set(environments[:slug] => generate_slug(name))
.where(environments[:id].eq(id))
diff --git a/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb b/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
index d77a22bfb69..6d9c7e4ed72 100644
--- a/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
+++ b/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb
@@ -1,5 +1,4 @@
class FixProjectRecordsWithInvalidVisibility < ActiveRecord::Migration[4.2]
- include Gitlab::Database::ArelMethods
include Gitlab::Database::MigrationHelpers
BATCH_SIZE = 500
@@ -34,7 +33,7 @@ class FixProjectRecordsWithInvalidVisibility < ActiveRecord::Migration[4.2]
end
updates.each do |visibility_level, project_ids|
- updater = arel_update_manager
+ updater = Arel::UpdateManager.new
.table(projects)
.set(projects[:visibility_level] => visibility_level)
.where(projects[:id].in(project_ids))
diff --git a/db/post_migrate/20170324160416_migrate_user_activities_to_users_last_activity_on.rb b/db/post_migrate/20170324160416_migrate_user_activities_to_users_last_activity_on.rb
index 73989339ad9..61a5c364b2f 100644
--- a/db/post_migrate/20170324160416_migrate_user_activities_to_users_last_activity_on.rb
+++ b/db/post_migrate/20170324160416_migrate_user_activities_to_users_last_activity_on.rb
@@ -1,6 +1,5 @@
# rubocop:disable Migration/UpdateLargeTable
class MigrateUserActivitiesToUsersLastActivityOn < ActiveRecord::Migration[4.2]
- include Gitlab::Database::ArelMethods
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
@@ -40,7 +39,7 @@ class MigrateUserActivitiesToUsersLastActivityOn < ActiveRecord::Migration[4.2]
activities = activities(day.at_beginning_of_day, day.at_end_of_day, page: page)
update_sql =
- arel_update_manager
+ Arel::UpdateManager.new
.table(users_table)
.set(users_table[:last_activity_on] => day.to_date)
.where(users_table[:username].in(activities.map(&:first)))