Managoat.OAuth.Migration (managoat_oauth v0.1.1)

Copy Markdown View Source

Creates the two tables Managoat.OAuth needs, from a migration of the host's own (the shape Oban uses; a hex package cannot run mix ecto.migrate for its host). In MyApp.Repo.Migrations.AddOAuth, say:

use Ecto.Migration

def up, do: Managoat.OAuth.Migration.up()
def down, do: Managoat.OAuth.Migration.down()

Options, the same for up/1 and down/1:

  • :subject_column — the name of the column that holds the host's subject, :user_id by default. It is a binary_id with no foreign key; a host that wants one references its own table in the same migration (alter table(:oauth_authorization_codes) do modify ...).
  • :prefix — the Postgres schema to create the tables in, the default schema when nil. Pass the same value as prefix: in the instance's config. up/1 creates the schema first unless create_schema: false.

Summary

Functions

Drop both tables. The schema, if :prefix named one, is left in place.

Create both tables and their indexes.

Functions

down(opts \\ [])

@spec down(keyword()) :: :ok

Drop both tables. The schema, if :prefix named one, is left in place.

up(opts \\ [])

@spec up(keyword()) :: :ok

Create both tables and their indexes.