Support for Triggers and LISTEN/Notify
There are huge differences between sqlite/mysql/postgres for writing triggers. If you need a trigger, just create it after your call to `db.create_tables(...)`:

```python
db.create_tables([MyModel, ...])
db.execute_sql('create trigger ...')
```

For LISTEN/NOTIFY, again, I'm not sure how Peewee would improve on this much as it's pretty straightforward. Just use `db.execute_sql('listen channel_name')` to subscribe, and then for notify:

```python
payload = {'now': time.time(), 'data': 'something'}
db.execute_sql('notify channel_name, %s', (json.dumps(payload),))
```

The psycopg2 docs contain an example of polling for updates, presumably you'd do this in a separate thread or use a coroutine library.
Great work on the library, it has been very flexible and quick to work with.

We are needing to notify a service whenever a table is updated. Our backend database is Postgres. Listen/Notify seems to optimally fit out needs. Ideally we need a way to trigger or notify on creation/updates, and then subscribe with polling to get responses.

## Pub implementation

On the pub side, there are two ways to implement this:

- A trigger on the table (similar to that described [here](https://stackoverflow.com/questions/5412474/using-pg-notify-in-postgresql-trigger-function))
- Bundling each insert/update in a transaction, and putting a notify at the end of it.

From a simplicity perspective, I would rather put a trigger in the table for the pub, then have a polling feature setup for subscribe. Does PeeWee or any integrated library via playhouse support triggers and adding them? I found a hack [implementation](https://stackoverflow.com/questions/34142550/sqlite-triggers-datetime-defaults-in-sql-ddl-using-peewee-in-python), is this what you would recommend if we wanted to add a trigger to the schema? This seems like a sensible addition at some point considering the power of pub/sub in postgres.

The other down-and-dirty implementation of this is to override the insert/update methods in the model and just turn them into transactions with a NOTIFY call at the end (we already do this for some things, such as insert_or_update where we query if the record exist and if not create, or if so update. Note that we do not use autoincrementing primary keys as we regularly create more than 2 billion records; we use uuid, so we lose a bit of your methods).

## Sub implementation

A sample implementation of this can be seen quickly on the psycopg website [here](http://initd.org/psycopg/docs/advanced.html#asynchronous-notifications). Is such a thing possible with PeeWee? How would you recommend building this?

Thank you a million, happy to do a MR to support the above if useful.

