On Dec 18, 6:06 am, James Nelson <[email protected]> wrote:
> Hi there,
>
> I've been trying to write some rake tasks like those available for
> active record migrations in rails. The thing I would particularly like
> to do is create a "sq:migrate:redo STEP=?" command which rolls back
> and then re-migrates the last ? migrations.
>
> However, it seems to me you'd neet to know the current migration
> version to do this, and this seems to be a private variable in the
> migrator.
>
> Is there any other way of making a task like this, or is it somehow
> possible to find the current migration version?

Well, the "version" only makes sense for the IntegerMigrator, which
has the public #current method for getting the current version.

For the TimestampMigrator, there is no "version".  You can get an
array of already #applied_migrations or use #migration_tuples if you
want more info on the what actions the migrator would take.  If you
wanted something like a "version" for the TimestampMigrator, you would
have to check that there is no gap in terms of the migrations.
Basically, if all unapplied migrations have a version number greater
than the greatest applied migration, the greatest applied migration's
number could be considered the "version".

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.

Reply via email to