Current section

Files

Jump to
logger_psql priv templates migration.exs.eex
Raw

priv/templates/migration.exs.eex

defmodule <%= module_prefix %>.Repo.Migrations.CreateLogTable do
use Ecto.Migration
def change do
<%= unless is_nil(db_prefix) or db_prefix == "" do %>
execute("CREATE SCHEMA <%= db_prefix %>", "DROP SCHEMA <%= db_prefix %> CASCADE")
<% end %>
create table(<%= inspect(schema_name) %>, primary_key: false<%= unless is_nil(db_prefix) or db_prefix == "", do: ", prefix: \"#{db_prefix}\"" %>) do
add :id, :binary_id, primary_key: true
add :level, :string
add :application, :string
add :domain, :string
add :file, :string
add :function, :string
add :line, :string
add :module, :string
add :pid, :string
add :time, :utc_datetime
add :message, :text
add :metadata, :map
add :request_id, :string
timestamps()
end
end
end