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 ![]()
AI-generated summary
In a discussion titled How to create migration files?, user dachary asked whether they should manually create a migration file or simply update the schema information in their model file to add a new table. User Overgrow clarified that a migration file is required and must be run via rake db:migrate, referencing the ActiveRecord docs for further details. dachary confirmed this resolved their confusion.
User Falco added a note that for plugin development, Discourse provides a PluginStore to avoid manual migrations, as uninstalling plugins with migrations can be problematic. When dachary requested an example of this in action, Falco pointed to the discourse-canned-replies plugin as a clear reference. Overgrow acknowledged this distinction, noting the difference between standard migrations and the PluginStore approach.
No, you need to create migrate file and run it with db:migrate (see ActiveRecord docs )
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.
Thanks, I’m glad I did not miss something ![]()
cool. Is there a plugin I could read to see how it’s used ? I found something on rubydoc.
Canned replies is recent and does it very clearly:
