Alternera.Resource.Migrations (alternera_resource_sdk v0.9.0)

Copy Markdown View Source

Runs a resource package's migrations into its own Postgres schema.

The schema is created first, and Ecto.Migrator runs with that schema as its prefix, so the package's schema_migrations table lives inside it. Dropping an orphaned package's schema therefore drops its migration record too, and a package added back later migrates from scratch.

The proxy's Alternera.Resources.Migrator and the package test kit (Alternera.Resource.Test) both run packages through here.

Summary

Functions

Runs every pending migration under path for the package of domain on Alternera.Resource.Repo, which must be started (or, in the proxy's tests, routed to a started repo). Returns the versions it ran. Extra opts go to Ecto.Migrator.run/4.

The package's Postgres schema, "resources_<package id>".

Functions

migrate(domain, path, opts \\ [])

@spec migrate(module(), Path.t(), keyword()) :: [integer()]

Runs every pending migration under path for the package of domain on Alternera.Resource.Repo, which must be started (or, in the proxy's tests, routed to a started repo). Returns the versions it ran. Extra opts go to Ecto.Migrator.run/4.

schema(domain)

@spec schema(module()) :: String.t()

The package's Postgres schema, "resources_<package id>".