mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 13:33:50 +12:00
39 lines
716 B
Elixir
39 lines
716 B
Elixir
|
defmodule AshPostgres.TestCustomExtension do
|
||
|
@moduledoc false
|
||
|
|
||
|
use AshPostgres.CustomExtension, name: "demo-functions", latest_version: 1
|
||
|
|
||
|
@impl true
|
||
|
def install(0) do
|
||
|
"""
|
||
|
execute(\"\"\"
|
||
|
CREATE OR REPLACE FUNCTION ash_demo_functions()
|
||
|
RETURNS boolean AS $$ SELECT TRUE $$
|
||
|
LANGUAGE SQL
|
||
|
IMMUTABLE;
|
||
|
\"\"\")
|
||
|
"""
|
||
|
end
|
||
|
|
||
|
@impl true
|
||
|
def install(1) do
|
||
|
"""
|
||
|
execute(\"\"\"
|
||
|
CREATE OR REPLACE FUNCTION ash_demo_functions()
|
||
|
RETURNS boolean AS $$ SELECT FALSE $$
|
||
|
LANGUAGE SQL
|
||
|
IMMUTABLE;
|
||
|
\"\"\")
|
||
|
"""
|
||
|
end
|
||
|
|
||
|
@impl true
|
||
|
def uninstall(_version) do
|
||
|
"""
|
||
|
execute(\"\"\"
|
||
|
DROP FUNCTION IF EXISTS ash_demo_functions()
|
||
|
\"\"\")
|
||
|
"""
|
||
|
end
|
||
|
end
|