diff --git a/pgsync/base.py b/pgsync/base.py index 4fcf933..608b7ac 100644 --- a/pgsync/base.py +++ b/pgsync/base.py @@ -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}()", @@ -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: @@ -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}" ) ) @@ -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}" ) )