How to create migration files?


(Loic Dachary) #1

I would like to create a new table (to store the graph for vote delegation). Should I create a migration file similar to db/migrate/20120311170118_create_users.rb manually ? Or is it enough to update the == Schema Information at the end of the model file ? I naively tried that and run rake db:migrate but it did not work :wink:


Discourse calendar plugin
(OG) #2

No, you need to create migrate file and run it with db:migrate (see ActiveRecord docs )


(Rafael dos Santos Silva) #3

Note that if you are developing a plugin, discourse provides a PluginStore to help you avoid migrations, since undoing then when the plugin gets uinstalled is a open problem.


PluginStore API - get row by attribute
(Loic Dachary) #4

Thanks, I’m glad I did not miss something :slight_smile:


(Loic Dachary) #5

cool. Is there a plugin I could read to see how it’s used ? I found something on rubydoc.


(Rafael dos Santos Silva) #6

Canned replies is recent and does it very clearly:


(OG) #7

OK, thanks… I see …