mix macaw_auth.gen.migration (macaw_auth v0.4.1)

Copy Markdown View Source

Writes the migrations that create the native backend's tables into the host's migrations, one file each:

The repo's name is --repo, else the configured one (config :macaw_auth, Macaw.Auth.Native, repo: MyApp.Repo); it is only written into the files as text. The path defaults to priv/repo/migrations.

Each has its own file, and the task writes only those not yet there: a host that has the users and sessions migrations gets the second factor's added after them, and a host that has all three is refused, so no table or column is ever created twice. Files are timestamped like mix ecto.gen.migration's, one second apart, so they run in order.

The migrations are plain DDL the host owns and can read, and they are the ones this library's own tests run against SQLite, so what ships is what is tested. They work on Postgres and SQLite alike: the array columns are {:array, :string}, a native array on Postgres and JSON text on SQLite.