summaryrefslogtreecommitdiff
path: root/db/migrate/20170825104051_migrate_issues_to_ghost_user.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20170825104051_migrate_issues_to_ghost_user.rb')
-rw-r--r--db/migrate/20170825104051_migrate_issues_to_ghost_user.rb37
1 files changed, 0 insertions, 37 deletions
diff --git a/db/migrate/20170825104051_migrate_issues_to_ghost_user.rb b/db/migrate/20170825104051_migrate_issues_to_ghost_user.rb
deleted file mode 100644
index b1adccc9c5c..00000000000
--- a/db/migrate/20170825104051_migrate_issues_to_ghost_user.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-class MigrateIssuesToGhostUser < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class User < ActiveRecord::Base
- self.table_name = 'users'
- end
-
- class Issue < ActiveRecord::Base
- self.table_name = 'issues'
-
- include ::EachBatch
- end
-
- def reset_column_in_migration_models
- ActiveRecord::Base.clear_cache!
-
- ::User.reset_column_information
- ::Namespace.reset_column_information
- end
-
- def up
- reset_column_in_migration_models
-
- # we use the model method because rewriting it is too complicated and would require copying multiple methods
- ghost_id = ::User.ghost.id
-
- Issue.where('NOT EXISTS (?)', User.unscoped.select(1).where('issues.author_id = users.id')).each_batch do |relation|
- relation.update_all(author_id: ghost_id)
- end
- end
-
- def down
- end
-end