On Monday, July 9, 2012 3:41:22 PM UTC-7, Matt Hauck wrote:
>
> I may have missed it, but is there an easy way to have Sequel generate a 
> schema.rb file like ActiveRecord does upon migration in order to reflect 
> the current state of the database? I find this quite useful for quick 
> reference without having to sort through all the different migrations to 
> find out what is db schema at present.
>
> I suppose a quickly little script could be written using DB.tables and 
> DB.schema, but just thought someone may have already done this and thus not 
> need to waste the effort....
>
>
The schema_dumper extension does this, and bin/sequel has support for it as 
well via the -d and -D options:

  sequel -d postgres://localhost/database > schema.rb

It's more advanced than ActiveRecord's schema dumper, since it dumps 
foreign keys and tables in topological order.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/EdvRyTd1K-sJ.
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