mix trace_guard.gen.ecto_migration (trace_guard v0.1.0)

Copy Markdown View Source

Generates an Ecto migration, in your application, that creates the table used by TraceGuard.Storage.Ecto (experimental).

mix trace_guard.gen.ecto_migration
mix trace_guard.gen.ecto_migration --repo MyApp.Repo --prefix diagnostics
mix ecto.migrate

The generated file pins the schema version, so later TraceGuard releases never change what an already-run migration does. Apart from the timestamp in its file name, the output is the same on every run.

The Repo and the directory are resolved as mix ecto.gen.migration resolves them: the Repo from --repo or your application's :ecto_repos, the directory from that Repo's :priv setting (default priv/repo/migrations), and the module is named <Repo>.Migrations.AddTraceGuardReports.

Options

  • --repo / -r: the Repo whose database will hold the table. Needed when :ecto_repos lists more than one. It must use Ecto.Adapters.Postgres.
  • --prefix: a PostgreSQL schema for the table (it must already exist). Use the same :prefix in the adapter's configuration.
  • --migrations-path: write the file here instead of the Repo's migrations directory.
  • --no-compile: don't compile the project first.

TraceGuard never runs migrations itself.