mirror of https://github.com/zulip/zulip.git
upgrade-zulip: Support arbitrary database user and dbname.
Co-authored-by: Adam Birds <adam.birds@adbwebdesigns.co.uk>
This commit is contained in:
parent
1d59330cbc
commit
7ff3c9f966
|
@ -139,6 +139,7 @@ if os.path.exists("/etc/init.d/postgresql"):
|
|||
if glob.glob("/usr/share/postgresql/*/extension/tsearch_extras.control"):
|
||||
# Remove legacy tsearch_extras package references
|
||||
run_psql_as_postgres(
|
||||
config_file=config_file,
|
||||
sql_query="DROP EXTENSION IF EXISTS tsearch_extras;",
|
||||
)
|
||||
subprocess.check_call(["apt-get", "remove", "-y", "postgresql-*-tsearch-extras"])
|
||||
|
|
|
@ -581,8 +581,10 @@ def get_deploy_options(config_file: configparser.RawConfigParser) -> List[str]:
|
|||
|
||||
|
||||
def run_psql_as_postgres(
|
||||
config_file: configparser.RawConfigParser,
|
||||
sql_query: str,
|
||||
) -> None:
|
||||
dbname = get_config(config_file, "postgresql", "database_name", "zulip")
|
||||
subcmd = " ".join(
|
||||
map(
|
||||
shlex.quote,
|
||||
|
@ -590,8 +592,8 @@ def run_psql_as_postgres(
|
|||
"psql",
|
||||
"-v",
|
||||
"ON_ERROR_STOP=1",
|
||||
# TODO: Stop hardcoding the database name.
|
||||
"zulip",
|
||||
"-d",
|
||||
dbname,
|
||||
"-c",
|
||||
sql_query,
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue