rihanna v0.5.2 Rihanna.Migration

A set of tools for creating the 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 arguments or setting the appropriate config option.

Using Ecto

The easiest way to create the database is with Ecto. Run mix ecto.gen.migration create_rihanna_jobs and make your migration look like this:

defmodule MyApp.CreateRihannaJobs do
  use Rihanna.Migration
end

Now you can run mix ecto.migrate.

Without Ecto

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

Link to this section Summary

Functions

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

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

Link to this section Functions

Link to this function sql(table_name \\ Rihanna.Config.jobs_table_name())
sql(String.t() | atom()) :: String.t()

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

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

Returns a list of SQL statements that will create 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.statements
[...]

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