Enumex.Dynamic.Migration (Enumex v1.0.0)
View SourceA module for handling database migrations for dynamic enum fields. The module handles the creation of necessary fields for dynamic enums, including the enum name, id, and index fields, with appropriate.
Summary
Main
Creates the necessary database fields for dynamic enum table,
similar to how timestamps are defined in ecto
.
Main
@spec enum_fields(Enumex.Dynamic.enum_field_opts()) :: :ok
Creates the necessary database fields for dynamic enum table,
similar to how timestamps are defined in ecto
.
Example
defmodule MyApp.Migration.CreateDynamicEnum do
use Ecto.Migration
import Enumex.Dynamic.Migration
def change do
create table(:enums) do
enum_fields([
enum_name: :name,
enum_name_type: :string,
id: :value,
id_type: :string,
index: :order,
index_type: :integer
])
end
end
end