Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add mix task for generating SQL #90

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions lib/ecto/postgres/pg_framerate_migrations.ex
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ defpgmodule Vtc.Ecto.Postgres.PgFramerate.Migrations do

@doc false
@impl PgTypeMigration
@spec ecto_type() :: module()
def ecto_type, do: PgFramerate

@doc false
@impl PgTypeMigration
@spec migrations_list() :: [PgTypeMigration.migration_func()]
def migrations_list do
[
&create_type_framerate_tags/0,
Expand Down Expand Up @@ -150,15 +152,6 @@ defpgmodule Vtc.Ecto.Postgres.PgFramerate.Migrations do

## FUNCTIONS

@doc section: :migrations_types
@doc """
Creates function schema as described by the
[Configuring Database Objects](Vtc.Ecto.Postgres.PgFramerate.Migrations.html#create_all/0-configuring-database-objects)
section above.
"""
@spec create_function_schemas() :: migration_info()
def create_function_schemas, do: PgTypeMigration.create_type_schema(:framerate)

@doc section: :migrations_functions
@doc """
Creates `framerate.is_ntsc(rat)` function that returns true if the framerate
Expand All @@ -167,7 +160,7 @@ defpgmodule Vtc.Ecto.Postgres.PgFramerate.Migrations do
@spec create_func_is_ntsc() :: migration_info()
def create_func_is_ntsc do
PgTypeMigration.create_plpgsql_function(
function(:is_ntsc, Migration.repo()),
function(:is_ntsc),
args: [input: :framerate],
returns: :boolean,
body: """
Expand All @@ -186,7 +179,7 @@ defpgmodule Vtc.Ecto.Postgres.PgFramerate.Migrations do
@spec create_func_strict_eq() :: migration_info()
def create_func_strict_eq do
PgTypeMigration.create_plpgsql_function(
private_function(:strict_eq, Migration.repo()),
private_function(:strict_eq),
args: [a: :framerate, b: :framerate],
returns: :boolean,
body: """
Expand All @@ -204,7 +197,7 @@ defpgmodule Vtc.Ecto.Postgres.PgFramerate.Migrations do
@spec create_func_strict_neq() :: migration_info()
def create_func_strict_neq do
PgTypeMigration.create_plpgsql_function(
private_function(:strict_neq, Migration.repo()),
private_function(:strict_neq),
args: [a: :framerate, b: :framerate],
returns: :boolean,
body: """
Expand All @@ -228,7 +221,7 @@ defpgmodule Vtc.Ecto.Postgres.PgFramerate.Migrations do
:===,
:framerate,
:framerate,
private_function(:strict_eq, Migration.repo()),
private_function(:strict_eq),
commutator: :===,
negator: :"!==="
)
Expand All @@ -245,7 +238,7 @@ defpgmodule Vtc.Ecto.Postgres.PgFramerate.Migrations do
:"!===",
:framerate,
:framerate,
private_function(:strict_neq, Migration.repo()),
private_function(:strict_neq),
commutator: :"!===",
negator: :===
)
Expand Down
Loading
Loading