Skip to content

Instantly share code, notes, and snippets.

@ratnikov
Created September 22, 2008 17:03
Show Gist options
  • Save ratnikov/12049 to your computer and use it in GitHub Desktop.
Save ratnikov/12049 to your computer and use it in GitHub Desktop.
# And finally decide EopgStatistics now depends on foo
class EpgStatistics < ActiveRecord::Base
has_one :foo
validates_presence_of :foo
end
# After a while you add a new model and migration:
class Foo < ActiveRecord::Base
end
class FooMigration
self.up
create_table :foos |foo|
# ...
end
end
end
def self.up
stats = EpgStatistics.all
change_column :epg_statistics, :lifetime, :float
change_column :epg_statistics, :latency, :float
stats.each {|s| s.save}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment