commanded / eventstore

Event store using PostgreSQL for persistence
MIT License
1.06k stars 146 forks source link

schema_migrations table name conflicts with ecto table #73

Open davich opened 7 years ago

davich commented 7 years ago

The schema_migrations table name introduced in v0.10.0 conflicts with the ecto table schema_migrations, yet it has different columns.

This means you are unable to use the same database for eventstore and your phoenix app.

Is there some way we could change the table name to not conflict, or make it configurable?

Thanks

davich commented 7 years ago

See: https://github.com/elixir-ecto/ecto/blob/master/lib/ecto/migration/schema_migration.ex

slashdotdash commented 7 years ago

Yes, it's worth making the table name configurable to allow the same database to be used for both events and read model projections.

As a temporary workaround Ecto allows you to rename its migration table in config.

Version numbers of migrations will be saved in schema_migrations table but you can configure the table via:

config :app, App.Repo, migration_source: "my_migrations"
dkushner commented 6 years ago

Seems like this is already on the radar, and the workaround provided is fairly reasonable, but since I'm here about 8 months down the line, figured I'd mention I've also run into this issue. May be worth mentioning in the documentation somewhere?

mustela commented 4 years ago

Yes, adding it to the documentation would be awesome. I ran into this issue this morning, and it took me some time to realise that there was a conflict with ecto. Thanks!

namxam commented 4 years ago

As it has not been mentioned yet, but there is a recent commit 6b2bbfe which introduces support for ecto schemas. It is also fairly documented in master. So it is an easy way to prevent before mentioned issue.