View Source Polyn.Migration.Migrator (Polyn v0.6.5)

Manages the creation and updating of streams and consumers that an application owns

Link to this section Summary

Types

Tuple of {command_name, command_options}

t()
  • :direction - Which direction to migrate
  • :migrations_function - The function to run inside the migration module (e.g. change, up, down)
  • :migrations_dir - Location of migration files
  • :running_migration_id - The timestamp/id of the migration file being run. Taken from the beginning of the file name
  • :migration_bucket_info - The Stream info for the migration KV bucket
  • :runner - Process for keeping commands to run
  • :migration_files - The file names of migration files
  • :migration_modules - A list of tuples with the migration id and module code
  • :already_run_migrations - Migrations we've determined have already been executed on the server
  • :commands - map of migration_id and commands to run

Functions

Path of migration files

Entry point for starting migrations

Link to this section Types

@type command() :: {atom(), any()}

Tuple of {command_name, command_options}

@type t() :: %Polyn.Migration.Migrator{
  already_run_migrations: [binary()],
  commands: %{required(binary()) => [command()]},
  direction: :up | :down,
  migration_bucket_info: Jetstream.API.Stream.info() | nil,
  migration_files: [binary()],
  migration_function: :change | :up | :down,
  migration_modules: [{integer(), module()}],
  migrations_dir: binary(),
  runner: pid() | nil,
  running_migration_id: non_neg_integer() | nil
}
  • :direction - Which direction to migrate
  • :migrations_function - The function to run inside the migration module (e.g. change, up, down)
  • :migrations_dir - Location of migration files
  • :running_migration_id - The timestamp/id of the migration file being run. Taken from the beginning of the file name
  • :migration_bucket_info - The Stream info for the migration KV bucket
  • :runner - Process for keeping commands to run
  • :migration_files - The file names of migration files
  • :migration_modules - A list of tuples with the migration id and module code
  • :already_run_migrations - Migrations we've determined have already been executed on the server
  • :commands - map of migration_id and commands to run

Link to this section Functions

Path of migration files

@spec run(opts :: [migrations_dir: binary(), direction: :down | :up]) :: :ok

Entry point for starting migrations

options

Options

  • :migrations_dir - Location of migration files
  • :direction - :up or :down to run migrations in a specific direction. Defaults to :up