Drop need case sensitive

This commit is contained in:
WQY\qiong
2023-04-07 23:24:44 +08:00
parent d315dc736c
commit 83873b38f3

View File

@@ -37,7 +37,7 @@ def delete_project(name: str) -> None:
with pg.connect(conninfo="dbname=postgres host=127.0.0.1", autocommit=True) as conn: with pg.connect(conninfo="dbname=postgres host=127.0.0.1", autocommit=True) as conn:
with conn.cursor() as cur: with conn.cursor() as cur:
cur.execute(f"select pg_terminate_backend(pid) from pg_stat_activity where datname = '{name}'") cur.execute(f"select pg_terminate_backend(pid) from pg_stat_activity where datname = '{name}'")
cur.execute(f"drop database {name}") cur.execute(f'drop database "{name}"')
def clean_project(excluded: list[str] = []) -> None: def clean_project(excluded: list[str] = []) -> None:
@@ -53,7 +53,7 @@ def clean_project(excluded: list[str] = []) -> None:
if project in _server_databases or project in excluded: if project in _server_databases or project in excluded:
continue continue
cur.execute(f"select pg_terminate_backend(pid) from pg_stat_activity where datname = '{project}'") cur.execute(f"select pg_terminate_backend(pid) from pg_stat_activity where datname = '{project}'")
cur.execute(f"drop database {project}") cur.execute(f'drop database "{project}"')
def open_project(name: str) -> None: def open_project(name: str) -> None: