Hi John, My thinking is that the "create_if_missing" option would default to true, meaning that Ruote::Sequel::Storage would automatically create the table only if it detects that the table does not already exist. That seems to be the most developer-friendly thing to do (it was the behavior I expected).
If there is a valid use case to always create the table no matter if it exists or not, then perhaps a "create_table" option that has 3 possible values - "never", "always", "if_missing" (default would be "if_missing") would be the way to go. Regards, Denis On Friday, July 12, 2013 12:45:55 AM UTC-5, John Mettraux wrote: > > > On Thu, Jul 11, 2013 at 09:47:33AM -0700, > [email protected]<javascript:>wrote: > > > > We are in the process of implementing ruote within our app, and I just > > switched our app from using Ruote::FsStorage to using > > Ruote::Sequel::Storage. I was a bit surprised that I had to manually > > create the table that ruote uses to persist its state. I was expecting > > Ruote::Sequel::Storage to automatically create whatever database tables > it > > needed on-the-fly (much like how Ruote::FsStorage automatically creates > > whatever internal structure it needs on disk to store the ruote > documents > > on-the-fly). Just curious if there is a reason why > Ruote::Sequel::Storage > > works this way? > > > > This is how I am initializing Ruote::Sequel::Storage in our app: > > > > sequel = Sequel.connect(db) > > Ruote::Sequel.create_table(sequel, false, 'ruote') > > storage = Ruote::Sequel::Storage.new(sequel, 'sequel_table_name' => > 'ruote') > > > > It would be nice if I just needed to do this: > > > > sequel = Sequel.connect(db) > > storage = Ruote::Sequel::Storage.new(sequel, 'sequel_table_name' => > > 'ruote', 're_create' => false) > > > > If this sounds like a good idea, I can certainly fork ruote-sequel on > > github, figure out how to make this change, and then issue a pull > request. > > Just let me know. > > Hello Denis, > > I tend to create the table via a rake task in the preparation phase. > > I think your pull request idea is good, please proceed with it. The > important > thing is to prevent integrators from nuking the table when initializing a > sequel storage, maybe "create_if_missing" => true is better than > "re_create" > => false, the default would be "create_if_missing" => false. > > > Looking forward to your pull request, thanks, > > -- > John Mettraux - http://lambda.io/jmettraux > > -- -- you received this message because you are subscribed to the "ruote users" group. to post : send email to [email protected] to unsubscribe : send email to [email protected] more options : http://groups.google.com/group/openwferu-users?hl=en --- You received this message because you are subscribed to the Google Groups "ruote" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
