Sha256: 4a73e43b048bb3e920c502dea1330e10ccdf099257b0ba9156bc2b0d5912413d
Contents?: true
Size: 696 Bytes
Versions: 27
Compression:
Stored size: 696 Bytes
Contents
class MakeUsersEnvironmentsSubscribedToAnArray < ActiveRecord::Migration def up rename_column :users, :environments_subscribed_to, :old_environments_subscribed_to add_column :users, :environments_subscribed_to, :text, array: true, default: [], null: false User.reset_column_information User.find_each do |user| environments = JSON.load user.old_environments_subscribed_to next if environments.nil? or environments.empty? user.update_column :environments_subscribed_to, environments end end def down remove_column :users, :environments_subscribed_to rename_column :users, :old_environments_subscribed_to, :environments_subscribed_to end end
Version data entries
27 entries across 27 versions & 1 rubygems