Skip to content

Commit

Permalink
Merge pull request #11 from ZeroCater/h/multi-schema
Browse files Browse the repository at this point in the history
Better support for multi schema DBs
  • Loading branch information
tpilara authored Jul 18, 2017
2 parents 0e3e94d + dd5c727 commit ddec712
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions pg_events/core/schemas/triggers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ BEGIN
information_schema.tables
WHERE
table_schema NOT IN ('pg_catalog', 'information_schema')
AND table_schema NOT LIKE 'pg_toast%'
AND table_name NOT LIKE 'pg_%'
AND table_name NOT LIKE '_%'
AND table_schema NOT LIKE 'pg\_toast%'
AND table_name NOT LIKE 'pg\_%'
AND table_name NOT LIKE '\_%'
LOOP
command := format(
'SET search_path TO %s; ' ||
'DROP TRIGGER IF EXISTS %s ON %s; ' ||
'CREATE TRIGGER %1$s AFTER INSERT OR UPDATE OR DELETE ON %2$s FOR EACH ROW EXECUTE PROCEDURE pgevents_data_update_notify();',
'CREATE TRIGGER %2$s AFTER INSERT OR UPDATE OR DELETE ON %3$s FOR EACH ROW EXECUTE PROCEDURE pgevents_data_update_notify();',
quote_ident(rec.table_schema),
format('pgevents_%s__%s', quote_ident(rec.table_schema), quote_ident(rec.table_name)),
quote_ident(rec.table_name)
);
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

setup(
name='pg_events',
version='0.1.4',
version='0.1.5',
description="Postgres events",
long_description='',
keywords='postgres python django trigger listen notify events heroku connect',
author='ZeroCater',
author_email='tech@zerocater.com',
url='https://github.com/ZeroCater/pg_events',
download_url='https://github.com/ZeroCater/pg_events/tarball/0.1.4',
download_url='https://github.com/ZeroCater/pg_events/tarball/0.1.5',
license='MIT',
packages=setuptools.find_packages(),
package_data={'pg_events': ['core/schemas/*.sql']},
Expand Down

0 comments on commit ddec712

Please sign in to comment.