FIX: Deleting old migration

FIX: Deleting old migration

It was using ActiveRecord which broke migrating a new site. The groups table now has a unique constraint on group name so this migration from 2014 should not be necessary anymore.

diff --git a/db/migrate/20141216112341_resolve_duplicate_group_names.rb b/db/migrate/20141216112341_resolve_duplicate_group_names.rb
deleted file mode 100644
index c9249af..0000000
--- a/db/migrate/20141216112341_resolve_duplicate_group_names.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class ResolveDuplicateGroupNames < ActiveRecord::Migration[4.2]
-
-  def up
-    results = DB.query_single 'SELECT id FROM groups
-                              WHERE name ILIKE
-                               (SELECT lower(name)
-                                FROM groups
-                                GROUP BY lower(name)
-                                HAVING count(*) > 1);'
-
-    groups = Group.where id: results
-    groups.group_by { |g| g.name.downcase }.each do |key, value|
-      value.each_with_index do |dup, index|
-        dup.update! name: "#{dup.name[0..18]}_#{index + 1}" if index > 0
-      end
-    end
-  end
-
-  def down
-    # does not reverse changes
-  end
-
-end

GitHub sha: c979f187

1 Like