Rihanna v1.1.3 Rihanna.Migration.Upgrade View Source

A set of tools for upgrading an existing Rihanna jobs table.

Rihanna stores jobs in a table in your database. The default table name is “rihanna_jobs”. The name is configurable by either passing it as an argument to the functions below or setting :jobs_table_name in Rihanna’s config.

Using Ecto

The easiest way to upgrade the database is with Ecto.

Run mix ecto.gen.migration upgrade_rihanna_jobs and make your migration look like this:

defmodule MyApp.UpgradeRihannaJobs do
  use Rihanna.Migration.Upgrade
end

Now you can run mix ecto.migrate.

Without Ecto

Ecto is not required to run Rihanna. If you want to upgrade the table yourself, without Ecto, take a look at either statements/0 or sql/0.

Link to this section Summary

Functions

Returns a list of SQL statements that will rollback the upgrade of Rihanna jobs table if executed sequentially

Returns a string of semi-colon-terminated SQL statements that you can execute directly to upgrade the Rihanna jobs table

Returns a list of SQL statements that will upgrade the Rihanna jobs table if executed sequentially

Link to this section Functions

Link to this function drop_statements(table_name \\ Rihanna.Config.jobs_table_name()) View Source

Returns a list of SQL statements that will rollback the upgrade of Rihanna jobs table if executed sequentially.

By default it takes the name of the table from the application config.

You may optionally supply a table name as an argument if you want to override this.

Examples

> Rihanna.Migration.Upgrade.drop_statements
[...]

> Rihanna.Migration.Upgrade.drop_statements("my_alternative_table_name")
[...]
Link to this function sql(table_name \\ Rihanna.Config.jobs_table_name()) View Source
sql(String.t() | atom()) :: String.t()

Returns a string of semi-colon-terminated SQL statements that you can execute directly to upgrade the Rihanna jobs table.

Link to this function statements(table_name \\ Rihanna.Config.jobs_table_name()) View Source
statements(String.t() | atom()) :: list(list(), String.t())
statements(String.t() | atom()) :: list(list(), String.t())

Returns a list of SQL statements that will upgrade the Rihanna jobs table if executed sequentially.

By default it takes the name of the table from the application config.

You may optionally supply a table name as an argument if you want to override this.

Examples

> Rihanna.Migration.Upgrade.statements
[...]

> Rihanna.Migration.Upgrade.statements("my_alternative_table_name")
[...]