This solution is as simple as awesome. :) I remembered when I studied the three sides of RubyOnRails: production, testing and development, that (as a newbie) freaked me out a little. If I'm not wrong, they have it because to change the database is not easy as change the connection database string.
On Wed, Dec 8, 2010 at 11:31 PM, Vidul <[email protected]> wrote: > Great, thank you Massimo! > > > On Dec 8, 8:22 pm, mdipierro <[email protected]> wrote: > > If you just have > > > > production=True > > if production: > > db=DAL('sqlite://production.sqlite') > > else: > > db=DAL('sqlite://test.sqlite') > > > > when you switch to production=False, it will recreate the missing > > tables in test.sqlite. > > > > On Dec 8, 8:10 am, Vidul <[email protected]> wrote: > > > > > > > > > I'd like to create a testing database which contains the same tables > > > as the production one. > > > This is the code I came up with: > > > > > for i in db_test.tables: > > > db_test[i].drop() > > > db_test.commit() > > > > > for i in db.tables: > > > db_test.define_table(i, db[i]) > > > db_test.commit() > > > > > Is there a better way? > > > > > Thank you for the help. >

