EctoPGMQ.Migrations (ecto_pgmq v1.0.0)

Copy Markdown View Source

The entrypoint for managing PGMQ-related Ecto.Migration implementations.

Summary

Extension Installation API

Creates the PGMQ extension in an Ecto.Migration.

Drops the PGMQ extension in an Ecto.Migration.

Updates the PGMQ extension to the default version in an Ecto.Migration.

Updates the PGMQ extension in an Ecto.Migration.

SQL Installation API

Drops the PGMQ schema in an Ecto.Migration.

Imports a PGMQ schema file in an Ecto.Migration.

EctoPGMQ API

create_queue(queue, attributes \\ %{}, opts \\ [])

Creates a queue with the given name in an Ecto.Migration.

For more information, see EctoPGMQ.create_queue/3.

Examples

create_queue("my_queue")

drop_queue(queue, opts \\ [])

@spec drop_queue(
  EctoPGMQ.Queue.name(),
  keyword()
) :: :ok

Drops the given queue in an Ecto.Migration.

For more information, see EctoPGMQ.drop_queue/3.

Examples

drop_queue("my_queue")

update_queue(queue, attributes, opts \\ [])

Updates the given queue in an Ecto.Migration.

For more information, see EctoPGMQ.update_queue/4.

Examples

update_queue("my_queue", %{notifications: 1_000})

Extension Installation API

create_extension()

@spec create_extension() :: :ok

Creates the PGMQ extension in an Ecto.Migration.

For more information, see PGMQ Installation.

Examples

create_extension()

drop_extension()

@spec drop_extension() :: :ok

Drops the PGMQ extension in an Ecto.Migration.

For more information, see PGMQ Installation.

Examples

drop_extension()

update_extension()

Updates the PGMQ extension to the default version in an Ecto.Migration.

For more information, see PGMQ Installation.

Examples

update_extension()

update_extension(version)

@spec update_extension(Version.version()) :: :ok

Updates the PGMQ extension in an Ecto.Migration.

For more information, see PGMQ Installation.

Examples

update_extension("1.9.0")

update_extension(Version.parse!("1.9.0"))

SQL Installation API

drop_schema()

@spec drop_schema() :: :ok

Drops the PGMQ schema in an Ecto.Migration.

Warning

This function should NOT be used if PGMQ is installed as an extension.

For more information, see PGMQ Installation.

Examples

drop_schema()

import_schema(path)

@spec import_schema(Path.t()) :: :ok

Imports a PGMQ schema file in an Ecto.Migration.

Warning

This function leverages the same adapter callback as mix ecto.load and therefore, requires that the psql shell utility is available.

For more information, see PGMQ Installation.

Examples

path =
  :my_app
  |> :code.priv_dir()
  |> Path.join("repo/extensions/pgmq--1.9.0.sql")

import_schema(path)