From d8e5c2e30319c1b03b7d5d53935321f116746364 Mon Sep 17 00:00:00 2001 From: Tolu Aina <7848930+toluaina@users.noreply.github.com> Date: Wed, 6 Jul 2022 21:50:02 +0100 Subject: [PATCH] fix bootstrap teardown drop function error #306 --- pgsync/__init__.py | 2 +- pgsync/base.py | 4 +++- pgsync/sync.py | 3 +-- setup.cfg | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pgsync/__init__.py b/pgsync/__init__.py index ab9b113d..455fe100 100644 --- a/pgsync/__init__.py +++ b/pgsync/__init__.py @@ -4,4 +4,4 @@ __author__ = "Tolu Aina" __email__ = "toluaina@hotmail.com" -__version__ = "2.3.0" +__version__ = "2.3.1" diff --git a/pgsync/base.py b/pgsync/base.py index 92315723..aae24771 100644 --- a/pgsync/base.py +++ b/pgsync/base.py @@ -569,7 +569,9 @@ def create_function(self, schema: str) -> None: ) def drop_function(self, schema: str) -> None: - self.execute(f'DROP FUNCTION IF EXISTS "{schema}".{TRIGGER_FUNC}()') + self.execute( + f'DROP FUNCTION IF EXISTS "{schema}".{TRIGGER_FUNC}() CASCADE' + ) def disable_triggers(self, schema: str) -> None: """Disable all pgsync defined triggers in database.""" diff --git a/pgsync/sync.py b/pgsync/sync.py index 30c65dc9..0ebc9b92 100644 --- a/pgsync/sync.py +++ b/pgsync/sync.py @@ -329,8 +329,7 @@ def teardown(self, drop_view: bool = True) -> None: ) if drop_view: self.drop_view(schema) - - self.drop_function(schema) + self.drop_function(schema) self.drop_replication_slot(self.__name) diff --git a/setup.cfg b/setup.cfg index b31123e2..755abc08 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.3.0 +current_version = 2.3.1 commit = True tag = True