uuid_helper_module v0.0.1 UuidHelperModule.UUIDMigration

Contains functions to add uuid columns to a table during migrations

Link to this section Summary

Functions

Adds an index on uuid column of the given table

Adds uuid column to a table.

Link to this section Functions

Link to this function

create_index_on_uuid(table_name)

Adds an index on uuid column of the given table

Parameters

  • table_name: the table for which the index has to be created

Adds uuid column to a table.

defmodule MyApp.Repo.Migrations.CreateUser do
  use Ecto.Migration
  import Trafi.ModelHelpers.UUID.Migration
  def change do
    create table(:users) do
      add :email, :string
      add :password, :string
      timestamps()

      uuid_column()
    end
  end
end