```ruby
class FixByPopularity < ActiveRecord::Migration
  def self.up
    ProductScope.update_all("name='descend_by_popularity'", "name='by_popularity'")
  end

  def self.down
  end
end
```

Add legacy ProductScope model to fix_by_popularity migration
user
```ruby
class FixByPopularity < ActiveRecord::Migration
  # Legacy table support
  class ProductScope < ActiveRecord::Base

  end
  def self.up
    ProductScope.update_all("name='descend_by_popularity'", "name='by_popularity'")
  end

  def self.down
  end
end
```
assistant