Skip to content

Commit 4d14e43

Browse files
committed
Make schema_diff_test work with non-postgres DB user
1 parent f0c2e77 commit 4d14e43

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmstestsuite/unit_tests/schema_diff_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ def run_pg_dump() -> str:
131131
def get_updated_schema(schema_file: str, updater_file: str) -> str:
132132
drop_db()
133133
schema_sql = open(schema_file).read()
134+
# The schema sets the owner of every object explicitly. We actually want
135+
# these objects to be owned by whichever user CMS uses, so we skip the
136+
# OWNER TO commands and let the owners be defaulted to the current user.
137+
schema_sql = '\n'.join(
138+
line
139+
for line in schema_sql.splitlines()
140+
if not (line.startswith('ALTER ') and ' OWNER TO ' in line)
141+
)
134142
updater_sql = open(updater_file).read()
135143
# We need to do this in two separate connections, since the schema_sql sets
136144
# some connection properties which we don't want.

0 commit comments

Comments
 (0)