View Source Rivet.Migration (rivet v2.3.5)

Summary

Functions

iex> datestamp(~N[2023-05-31 08:11:59]) "20230531081159" iex> String.length(datestamp()) == 20

iex> load_data_file("nar")

iex> maxlen_in(["a", "bcde", "fgh", "xyzabcdef"]) 9

iex> migration_model(This.Narf.Migrations) "Narf" iex> migration_model(This.Narf.Not) "Not"

iex> module_extend(This.Module, Narf) This.Module.Narf

iex> module_pop(This.Module.Narf) This.Module

iex> nodot("this/narf/not.ex") ["this", "narf", "not.ex"] iex> nodot("./narf/not.ex") ["narf", "not.ex"]

iex> pad("x", 4) "000x" iex> pad("4", -4) "4000" iex> pad(4, -4) "4000" iex> pad(4, 4) "0004"

Types

@type rivet_config() :: %{
  app: String.t(),
  base: atom(),
  base_path: String.t(),
  models_root: String.t(),
  opts: Keyword.t(),
  tests_root: String.t()
}
@type rivet_error() :: {:error, String.t() | atom()}
Link to this type

rivet_migration_input_any()

View Source
Link to this type

rivet_migration_input_external()

View Source
@type rivet_migration_input_external() :: %{
  external: String.t(),
  migrations: [rivet_migration_input_include()]
}
Link to this type

rivet_migration_input_include()

View Source
@type rivet_migration_input_include() :: %{include: module(), prefix: integer()}
Link to this type

rivet_migration_input_model()

View Source
@type rivet_migration_input_model() :: map()
Link to this type

rivet_migration_state()

View Source
@type rivet_migration_state() :: %{
  idx: %{required(integer()) => t()},
  mods: %{required(atom()) => list()}
}
@type rivet_migrations() :: [t()]
@type rivet_state_result() :: {:ok, rivet_migration_state()} | rivet_error()
@type t() :: %Rivet.Migration{
  base: boolean(),
  external: nil | String.t(),
  include: nil | module(),
  index: nil | String.t(),
  migrations: nil | list(),
  model: nil | module(),
  module: nil | module(),
  parent: nil | module(),
  path: nil | String.t(),
  prefix: nil | integer(),
  version: integer()
}

Functions

iex> datestamp(~N[2023-05-31 08:11:59]) "20230531081159" iex> String.length(datestamp()) == 20

@spec load_data_file(String.t()) :: {:ok, [list()]} | rivet_error()

iex> load_data_file("nar")

iex> load_data_file("test/rivet_test_input")

force an error

iex> load_data_file("LICENSE.txt")

Link to this function

maxlen_in(list, func \\ & &1)

View Source

iex> maxlen_in(["a", "bcde", "fgh", "xyzabcdef"]) 9

iex> migration_model(This.Narf.Migrations) "Narf" iex> migration_model(This.Narf.Not) "Not"

Link to this function

module_extend(parent, mod)

View Source

iex> module_extend(This.Module, Narf) This.Module.Narf

iex> module_pop(This.Module.Narf) This.Module

iex> nodot("this/narf/not.ex") ["this", "narf", "not.ex"] iex> nodot("./narf/not.ex") ["narf", "not.ex"]

iex> pad("x", 4) "000x" iex> pad("4", -4) "4000" iex> pad(4, -4) "4000" iex> pad(4, 4) "0004"