> As for my question: what exactly the plugin is doing that makes > everything work -- and how can I do it myself, without using the > plugin?
The migration plugin just gives users a fairly simple ActiveRecord- like way of managing changes to schema. Migrations themselves are fairly pointless unless you are using the Migrator (which handles multiple migrations at once). Instead of a single migration, you are better off just calling the schema methods directly on the Database object. > I'm trying to look at the source code for > Sequel::Model::ClassMethods.plugin to see if there's some easy routine > I can explicitly apply post-migration-application to my pre-migration- > application-defined models. You can't. You should be defining your models after all schema changes have been made. Usually it's fairly simple to change the load order in your app so models are loaded after migrations have been run. If you can't do so, just be sure to call set_dataset on all of your models after the migrations have been run. With the subclasses plugin, this is fairly easy. > That the current situation (of having to define one's models strictly > after a migration) is by design is recognizable, but I am having > trouble understanding it. This makes me want to try to work around it > for the purposes of my application. Trouble understanding the reason for it? Sequel executes a lot of code when the classes are defined. This includes parsing the database schema to get the columns and types. This is why they should be loaded after all changes to the database have been made. Otherwise, let's say you add a column in a migration after creating the related model class. The model class will then not have that migration defined unless you call set_dataset to reinitialize things. Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
