Show More
@@ -137,7 +137,8 b' logview.pylons.util = #eee' | |||||
137 | ######################################################### |
|
137 | ######################################################### | |
138 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
138 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### | |
139 | ######################################################### |
|
139 | ######################################################### | |
140 | sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db |
|
140 | #sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db | |
|
141 | sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode | |||
141 | #sqlalchemy.db1.echo = False |
|
142 | #sqlalchemy.db1.echo = False | |
142 | #sqlalchemy.db1.pool_recycle = 3600 |
|
143 | #sqlalchemy.db1.pool_recycle = 3600 | |
143 | sqlalchemy.convert_unicode = true |
|
144 | sqlalchemy.convert_unicode = true |
@@ -69,12 +69,17 b' class DbManage(object):' | |||||
69 | self.db_exists = True |
|
69 | self.db_exists = True | |
70 | if not override: |
|
70 | if not override: | |
71 | raise Exception('database already exists') |
|
71 | raise Exception('database already exists') | |
|
72 | return 'sqlite' | |||
|
73 | if self.dburi.startswith('postgresql'): | |||
|
74 | self.db_exists = True | |||
|
75 | return 'postgresql' | |||
|
76 | ||||
72 |
|
77 | |||
73 | def create_tables(self, override=False): |
|
78 | def create_tables(self, override=False): | |
74 | """Create a auth database |
|
79 | """Create a auth database | |
75 | """ |
|
80 | """ | |
76 |
|
81 | |||
77 | self.check_for_db(override) |
|
82 | db_type = self.check_for_db(override) | |
78 | if self.db_exists: |
|
83 | if self.db_exists: | |
79 | log.info("database exist and it's going to be destroyed") |
|
84 | log.info("database exist and it's going to be destroyed") | |
80 | if self.tests: |
|
85 | if self.tests: | |
@@ -84,7 +89,11 b' class DbManage(object):' | |||||
84 | if not destroy: |
|
89 | if not destroy: | |
85 | sys.exit() |
|
90 | sys.exit() | |
86 | if self.db_exists and destroy: |
|
91 | if self.db_exists and destroy: | |
87 | os.remove(jn(self.root, self.dbname)) |
|
92 | if db_type == 'sqlite': | |
|
93 | os.remove(jn(self.root, self.dbname)) | |||
|
94 | if db_type == 'postgresql': | |||
|
95 | meta.Base.metadata.drop_all() | |||
|
96 | ||||
88 | checkfirst = not override |
|
97 | checkfirst = not override | |
89 | meta.Base.metadata.create_all(checkfirst=checkfirst) |
|
98 | meta.Base.metadata.create_all(checkfirst=checkfirst) | |
90 | log.info('Created tables for %s', self.dbname) |
|
99 | log.info('Created tables for %s', self.dbname) |
@@ -137,7 +137,8 b' logview.pylons.util = #eee' | |||||
137 | ######################################################### |
|
137 | ######################################################### | |
138 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
138 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### | |
139 | ######################################################### |
|
139 | ######################################################### | |
140 | sqlalchemy.db1.url = sqlite:///%(here)s/test.db |
|
140 | #sqlalchemy.db1.url = sqlite:///%(here)s/test.db | |
|
141 | sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode_tests | |||
141 | #sqlalchemy.db1.echo = False |
|
142 | #sqlalchemy.db1.echo = False | |
142 | #sqlalchemy.db1.pool_recycle = 3600 |
|
143 | #sqlalchemy.db1.pool_recycle = 3600 | |
143 | sqlalchemy.convert_unicode = true |
|
144 | sqlalchemy.convert_unicode = true |
General Comments 0
You need to be logged in to leave comments.
Login now