diff --git a/history_tracker.sql b/history_tracker.sql index d128bdb..d8269a5 100644 --- a/history_tracker.sql +++ b/history_tracker.sql @@ -113,7 +113,6 @@ LANGUAGE plpgsql VOLATILE; -- HT_Init --- TODO: warn when initing already enabled table (upgrades) CREATE OR REPLACE FUNCTION HT_Init(dbschema text, dbtable text) RETURNS text AS $BODY$ @@ -160,7 +159,8 @@ if plpy.execute("SELECT _HT_TableExists('history_tracker', '%(dbschema)s__%(dbta plpy.execute(sql_history_tab) plpy.execute(sql_history_tab2) plpy.execute(sql_create_difftype) - +else: + plpy.warning('History already enabled, upgrading history triggers.') #AtTime function sql_attime_funct = """ diff --git a/test/test_edit.sql b/test/test_edit.sql index 7164065..b4d46c1 100644 --- a/test/test_edit.sql +++ b/test/test_edit.sql @@ -28,7 +28,7 @@ - SELECT plan(46); + SELECT plan(47); -- TEST EMPTY TABLE SELECT is(ht_init('myschema', 'mytable'), 'History is enabled.', '*** Init history (empty table). ***'); @@ -311,6 +311,7 @@ ' => Check timestamp values in history table.' ); + SELECT is(ht_init('myschema', 'mytable'), 'History is enabled.', '*** Upgrade history triggers. ***'); SELECT * FROM finish(); --ROLLBACK;