mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-13 12:33:25 +02:00
Fix search path for schema in db (#188)
This commit is contained in:
parent
e5f51002cc
commit
d9783d8c9a
1 changed files with 5 additions and 1 deletions
|
|
@ -51,7 +51,10 @@ class PostgresDb:
|
|||
create_schema_sql = sql.SQL("CREATE SCHEMA IF NOT EXISTS {};").format(
|
||||
sql.Identifier(schema_name)
|
||||
)
|
||||
use_schema_sql = sql.SQL("ALTER ROLE {} SET search_path TO {};").format(
|
||||
use_schema_sql = sql.SQL("SET search_path TO {};").format(
|
||||
sql.Identifier(schema_name),
|
||||
)
|
||||
use_schema_for_user_sql = sql.SQL("ALTER ROLE {} SET search_path TO {};").format(
|
||||
sql.Identifier(self.user),
|
||||
sql.Identifier(schema_name),
|
||||
)
|
||||
|
|
@ -60,6 +63,7 @@ class PostgresDb:
|
|||
logger.info("Creating schema: {}".format(schema_name))
|
||||
curs.execute(create_schema_sql)
|
||||
curs.execute(use_schema_sql)
|
||||
curs.execute(use_schema_for_user_sql)
|
||||
|
||||
def init(self):
|
||||
""" Create the tables and indices in the database. """
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue