Rihanna v2.3.1 Rihanna.Migration View Source

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 it as an argument to the functions below or setting :jobs_table_name in Rihanna's config.

Using Ecto

The easiest way to create the database is with Ecto.

Run mix ecto.gen.migration create_rihanna_jobs and make your migration file 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 list of SQL statements that will drop the Rihanna jobs table if executed sequentially.

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

drop_statements(table_name \\ Rihanna.Config.jobs_table_name())

View Source

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

> Rihanna.Migration.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 create 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())

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")
[...]