Mutiny.Adapters.Postgres (mutiny v0.1.0) View Source
Implements Mutiny.Adapter
to provide commands for PostgreSQL.
Link to this section Summary
Functions
Returns a PostgreSQL function that can be triggered to prevent UPDATE
s to a
database table.
Returns a PostgreSQL command that drops the function created by
create_prevent_update_function/0
, if it exists.
Returns a PostgreSQL command to create a database trigger that prevents
UPDATE
s to the given Ecto.Migration.Table
.
Returns a PostgreSQL command to create a database trigger that prevents
UPDATE
s to the given columns
of the Ecto.Migration.Table
.
Link to this section Functions
Returns a PostgreSQL function that can be triggered to prevent UPDATE
s to a
database table.
Examples
iex> create_prevent_update_function()
"CREATE OR REPLACE FUNCTION prevent_update()..."
Returns a PostgreSQL command that drops the function created by
create_prevent_update_function/0
, if it exists.
Examples
iex> drop_prevent_update_function()
"DROP FUNCTION IF EXISTS prevent_update();"
Returns a PostgreSQL command to create a database trigger that prevents
UPDATE
s to the given Ecto.Migration.Table
.
Examples
iex> protect(table("users"))
"CREATE OR REPLACE TRIGGER prevent_update..."
Returns a PostgreSQL command to create a database trigger that prevents
UPDATE
s to the given columns
of the Ecto.Migration.Table
.
Examples
iex> protect(table("users"), [:uuid, :birthdate])
"DO $$..."
iex> protect(table("users"), [:uuid], nullable: true)
"DO $$..."
Options
nullable
- Whether thecolumns
can be set toNULL
; defaults tofalse