dawdle_db v0.6.0 DawdleDB.Migration
Utilities for managing the DawdleDB events table and notification related triggers.
Examples
defmodule MyApp.DawdleDBSetup do
use Ecto.Migration
import DawdleDB.Migration
def up do
create_watcher_events_table()
update_notify("users", [:insert, :update, :delete])
end
def down do
remove_notify("users", [:insert, :update, :delete])
drop_watcher_events_table()
end
end
Link to this section Summary
Functions
Creates the DawdleDB watcher events table.
Drops the DawdleDB watcher events table.
Remove event notification function/trigger from a table.
Add event notification function/trigger to a table.
Link to this section Types
Link to this section Functions
Creates the DawdleDB watcher events table.
This table is necessary for DawdleDB to manage events.
Drops the DawdleDB watcher events table.
Link to this function
remove_notify(table, actions)
remove_notify(table(), DawdleDB.Event.action() | [DawdleDB.Event.action()]) :: :ok
Remove event notification function/trigger from a table.
Examples
remove_notify("my_table", [:insert])
Link to this function
update_notify(table, actions, overrides \\ [])
update_notify(table(), [DawdleDB.Event.action()], [override()]) :: :ok
Add event notification function/trigger to a table.
To override the encoding of particular fields, provide an override with
$ITEM$
as the item to be overridden. For example, to override the encoding
of the "title" field, use: {"title", "my_encoding_function($ITEM$)"}
.
Examples
update_notify("my_table", [:insert, :update])
update_notify("other_table", [:insert], [{"title", "my_encoding_function($ITEM$)"}])