EctoPGMQ.Migrations (ecto_pgmq v2.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

Migrations.create_queue("my_queue")

drop_queue(queue, opts \\ [])

@spec drop_queue(EctoPGMQ.Queue.name(), [EctoPGMQ.PGMQ.query_opt()]) :: :ok

Drops the given queue in an Ecto.Migration.

For more information, see EctoPGMQ.drop_queue/3.

Examples

Migrations.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

Migrations.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

Migrations.create_extension()

drop_extension()

@spec drop_extension() :: :ok

Drops the PGMQ extension in an Ecto.Migration.

For more information, see PGMQ Installation.

Examples

Migrations.drop_extension()

update_extension()

@spec update_extension() :: :ok

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

For more information, see PGMQ Installation.

Examples

Migrations.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

Migrations.update_extension("1.12.0")

Migrations.update_extension(Version.parse!("1.12.0"))

SQL Installation API

drop_schema()

@spec drop_schema() :: :ok

Drops the PGMQ schema in an Ecto.Migration.

SQL-Installation Only

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

For more information, see PGMQ Installation.

Examples

Migrations.drop_schema()

import_schema(path)

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

Imports a PGMQ schema file in an Ecto.Migration.

Shell Utility Requirement

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.12.0.sql")

Migrations.import_schema(path)