Add postgresql.create_schema()
This commit is contained in:
parent
0b5f6234ad
commit
325f85a4b3
|
@ -115,6 +115,14 @@ def create_db(c, name, owner=None, port=None, checkfirst=True):
|
|||
c.sudo(cmd, user='postgres')
|
||||
|
||||
|
||||
def create_schema(c, name, dbname, owner='rattail', port=None):
|
||||
"""
|
||||
Create a schema within a PostgreSQL database.
|
||||
"""
|
||||
sql_ = "create schema if not exists {} authorization {}".format(name, owner)
|
||||
sql(c, sql_, database=dbname, port=port)
|
||||
|
||||
|
||||
def drop_db(c, name, checkfirst=True):
|
||||
"""
|
||||
Drop a PostgreSQL database.
|
||||
|
|
Loading…
Reference in a new issue