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,6 +43,7 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") |
|
46 | if self.db_exists: | |
|
44 | 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) |
General Comments 0
You need to be logged in to leave comments.
Login now