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.