- use a template database for PG so extensions get created automatically

This commit is contained in:
Mike Bayer
2014-07-25 20:19:06 -04:00
parent 306047c006
commit e602a73197
+7 -4
View File
@@ -1,5 +1,6 @@
from sqlalchemy.engine import url as sa_url
def create_follower_db(follower_ident):
from .. import config, engines
@@ -7,6 +8,9 @@ def create_follower_db(follower_ident):
hosts = set()
for cfg in config.Config.all_configs():
cfg.db.dispose()
for cfg in config.Config.all_configs():
url = cfg.db.url
backend = url.get_backend_name()
@@ -40,13 +44,12 @@ def _pg_create_db(eng, ident):
conn.execute("DROP DATABASE %s" % ident)
except:
pass
conn.execute("CREATE DATABASE %s" % ident)
currentdb = conn.scalar("select current_database()")
conn.execute("CREATE DATABASE %s TEMPLATE %s" % (ident, currentdb))
def _pg_init_db(eng):
with eng.connect() as conn:
conn.execute("CREATE SCHEMA test_schema")
conn.execute("CREATE SCHEMA test_schema_2")
pass
def _mysql_create_db(eng, ident):