Skip to content

Commit

Permalink
bugfix: fixed template for migration if prefix is set to an empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
er-jpg committed Jul 25, 2023
1 parent aba8105 commit 37a19cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Fixing message field.
### Fixed
- Fixes [https://github.com/er-jpg/logger_psql/issues/1](#1), allowing messages other than string to be inserted
- Typos in documentation
- Fixed if in config prefix was set to an empty string, it would fail

## [0.1.1] - 2023-06-09

Expand Down
4 changes: 2 additions & 2 deletions priv/templates/migration.exs.eex
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ defmodule <%= module_prefix %>.Repo.Migrations.CreateLogTable do
use Ecto.Migration

def change do
<%= if not is_nil(db_prefix) 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<%= if not is_nil(db_prefix), do: ", prefix: \"#{db_prefix}\"" %>) do
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
Expand Down

0 comments on commit 37a19cb

Please sign in to comment.