samsondav / rihanna

Rihanna is a high performance postgres-backed job queue for Elixir
MIT License
439 stars 49 forks source link

Rollback of rihanna migration breaks #25

Closed thiamsantos closed 6 years ago

thiamsantos commented 6 years ago

I'm running the rollback of rihanna migration and appears that the sql that drops the table has a syntax error:

-DROP TABLE(rihanna_jobs);\n
+DROP TABLE rihanna_jobs;\n

Versions:

The error:

13:32:42.321 [info] execute "DROP TABLE(rihanna_jobs);\n"
** (Postgrex.Error) ERROR 42601 (syntax_error): syntax error at or near "("
    (ecto) lib/ecto/adapters/sql.ex:200: Ecto.Adapters.SQL.query!/5
    (ecto) lib/ecto/adapters/postgres.ex:96: anonymous fn/4 in Ecto.Adapters.Postgres.execute_ddl/3
    (elixir) lib/enum.ex:1899: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ecto) lib/ecto/adapters/postgres.ex:96: Ecto.Adapters.Postgres.execute_ddl/3
    (ecto) lib/ecto/migration/runner.ex:104: anonymous fn/2 in Ecto.Migration.Runner.flush/0
    (elixir) lib/enum.ex:1899: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ecto) lib/ecto/migration/runner.ex:102: Ecto.Migration.Runner.flush/0
    (stdlib) timer.erl:181: :timer.tc/2
    (ecto) lib/ecto/migration/runner.ex:26: Ecto.Migration.Runner.run/6
    (ecto) lib/ecto/migrator.ex:128: Ecto.Migrator.attempt/6
    (ecto) lib/ecto/migrator.ex:105: anonymous fn/4 in Ecto.Migrator.do_down/4
    (ecto) lib/ecto/adapters/sql.ex:576: anonymous fn/3 in Ecto.Adapters.SQL.do_transaction/3
    (db_connection) lib/db_connection.ex:1283: DBConnection.transaction_run/4
    (db_connection) lib/db_connection.ex:1207: DBConnection.run_begin/3
    (db_connection) lib/db_connection.ex:798: DBConnection.transaction/3
    (ecto) lib/ecto/migrator.ex:262: anonymous fn/4 in Ecto.Migrator.migrate/4
    (elixir) lib/enum.ex:1294: Enum."-map/2-lists^map/1-0-"/2
    (elixir) lib/enum.ex:1294: Enum."-map/2-lists^map/1-0-"/2
    (ecto) lib/mix/tasks/ecto.rollback.ex:79: anonymous fn/4 in Mix.Tasks.Ecto.Rollback.run/2
    (elixir) lib/enum.ex:737: Enum."-each/2-lists^foreach/1-0-"/2

Migration file:

defmodule MyApp.Repo.Migrations.CreateRihannaJobs do
  use Rihanna.Migration
end

I would be glad to open a PR fixing this error if it was confirmed to be true.

samsondav commented 6 years ago

Thank you @thiamsantos for reporting this issue.

Yes, this certainly looks like a mistake. I never actually tested the rollback!

I would love to see a PR ❤️ 💜 💛 💚 💙

samsondav commented 6 years ago

Closed by #26

@thiamsantos - do you need a release?

thiamsantos commented 6 years ago

@thiamsantos - do you need a release?

@samphilipd yes, a release would be great.

samsondav commented 6 years ago

Done.

thiamsantos commented 6 years ago

@samphilipd thanks :tada: