Skip to content

Commit

Permalink
Allow to disable mod plugin in sync_triggers (kvesteri#273)
Browse files Browse the repository at this point in the history
Pass sync_triggers kwargs through to create_triggers

Allows use of native versioning without mod tracking
  • Loading branch information
nanvel authored and AbdealiLoKo committed Aug 23, 2022
1 parent 1671e2b commit 312bb35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/native_versioning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ When making schema migrations (for example adding new columns to version tables)


sync_trigger(conn, 'article_version')

If you don't use `PropertyModTrackerPlugin`, then you have to disable it:

::

sync_trigger(conn, 'article_version', use_property_mod_tracking=False)
5 changes: 3 additions & 2 deletions sqlalchemy_continuum/dialects/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def create_versioning_trigger_listeners(manager, cls):
)


def sync_trigger(conn, table_name):
def sync_trigger(conn, table_name, **kwargs):
"""
Synchronizes versioning trigger for given table with given connection.
Expand All @@ -468,6 +468,7 @@ def sync_trigger(conn, table_name):
:param conn: SQLAlchemy connection object
:param table_name: Name of the table to synchronize versioning trigger for
:params **kwargs: kwargs to pass to create_trigger
.. versionadded: 1.1.0
"""
Expand All @@ -489,7 +490,7 @@ def sync_trigger(conn, table_name):
set(c.name for c in version_table.c if not c.name.endswith('_mod'))
)
drop_trigger(conn, parent_table.name)
create_trigger(conn, table=parent_table, excluded_columns=excluded_columns)
create_trigger(conn, table=parent_table, excluded_columns=excluded_columns, **kwargs)


def create_trigger(
Expand Down

0 comments on commit 312bb35

Please sign in to comment.