hi i would like to make my application generate database at startup
(sth like first run) - i mean generating automatically all needed
relations (hardcoded)..
on startup i would like to check if database was prepared before
How to achieve this? what to do with migration?
i though about such code (doesn't work) in db.py
if 'places' in db.tables: #that means db was created before
print "Loading Database..."
GLOBAL_MIGRATE=False #tables already exists
else:
print "This is first run, database is not prepared! Generating
it..." # create tables
GLOBAL_MIGRATE=True
#and below put all necessary data to tables
i use GLOBAL_MIGRATE to set migrate on all tables.