##// END OF EJS Templates
fixed bug when there was no dbfile, and dbmanage raise an exception
marcink -
r243:9d64df49 default
parent child Browse files
Show More
@@ -26,10 +26,12 b' class DbManage(object):'
26 26 engine = create_engine(dburi, echo=log_sql)
27 27 init_model(engine)
28 28 self.sa = Session()
29 self.db_exists = False
29 30
30 31 def check_for_db(self, override):
31 32 log.info('checking for exisiting db')
32 33 if os.path.isfile(jn(ROOT, self.dbname)):
34 self.db_exists = True
33 35 log.info('database exisist')
34 36 if not override:
35 37 raise Exception('database already exists')
@@ -41,7 +43,8 b' class DbManage(object):'
41 43 self.check_for_db(override)
42 44 if override:
43 45 log.info("database exisist and it's going to be destroyed")
44 os.remove(jn(ROOT, self.dbname))
46 if self.db_exists:
47 os.remove(jn(ROOT, self.dbname))
45 48 Base.metadata.create_all(checkfirst=override)
46 49 log.info('Created tables for %s', self.dbname)
47 50
General Comments 0
You need to be logged in to leave comments. Login now