Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename triggers to include schema for uniqueness in schema based mult… #583

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pgsync/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ def create_triggers(
]:
self.drop_triggers(schema, [table])
queries.append(
f'CREATE TRIGGER "{table}_{name}" '
f'CREATE TRIGGER "{schema}_{table}_{name}" '
f'AFTER {" OR ".join(tg_op)} ON "{schema}"."{table}" '
f"FOR EACH {level} EXECUTE PROCEDURE "
f"{schema}.{TRIGGER_FUNC}()",
Expand All @@ -696,7 +696,7 @@ def drop_triggers(
logger.debug(f"Dropping trigger on table: {schema}.{table}")
for name in ("notify", "truncate"):
queries.append(
f'DROP TRIGGER IF EXISTS "{table}_{name}" ON '
f'DROP TRIGGER IF EXISTS "{schema}_{table}_{name}" ON '
f'"{schema}"."{table}"'
)
if join_queries:
Expand Down Expand Up @@ -732,7 +732,7 @@ def disable_trigger(self, schema: str, table: str) -> None:
self.execute(
sa.text(
f'ALTER TABLE "{schema}"."{table}" '
f"DISABLE TRIGGER {table}_{name}"
f"DISABLE TRIGGER {schema}_{table}_{name}"
)
)

Expand All @@ -749,7 +749,7 @@ def enable_trigger(self, schema: str, table, str) -> None:
self.execute(
sa.text(
f'ALTER TABLE "{schema}"."{table}" '
f"ENABLE TRIGGER {table}_{name}"
f"ENABLE TRIGGER {schema}_{table}_{name}"
)
)

Expand Down