On Wednesday, February 24, 2016 at 3:43:22 PM UTC-8, Amadeus Folego wrote:
>
> On Wed, Feb 24, 2016 at 03:26:16PM -0800, Jeremy Evans wrote: 
> > Can you explain your use case for this?  If you already have a 
> schema_info/ 
> > schema_migrations table, you are probably already using migrations, and 
> > therefore I'm not sure why you'd want to do this. 
>
> I can't speack for Giovanni, but I had the same problem in the past and 
> would welcome a schema loader. 
>
> My main use case is to load the schema of my web application before 
> running my test suite. 
>

My approach to testing is to migrate your test database as you migrate your 
development and production databases.  So you only migrate your test 
database when you have a new migration, and it would only apply that 
migration on the test database.  The application tests should be 
transactional, so after running the tests the database is in the same state 
it was before.  I've been using this approach for many years and find it's 
the simplest way to handle things.  However, such an approach doesn't 
really work in cases where the testing environment is ephemeral.

Note that you can load the schema dump fairly easily without worrying about 
schema_info/schema_migrations, by using the migration directly instead of 
the migrator:

Sequel.extension :migration
load('schema_dump.rb')
Migration.descendants.first.apply(DB, :up)

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to