I’m making a simple Phoenix app to manage links to news. The articles relate to data in a Rails app. I’d like for the Phoenix tables to live alongside Rails tables in the same Postgres database and schema. The Phoenix app would get read-only access to the Rails tables, and vice-versa.
I’ve run into a couple of roadbumps:
- Both Rails and Phoenix use a table,
schema_migrations
. But the tables’ structures as created by the frameworks are different. - Keeping everything in the same schema seems less problematic: both frameworks don’t work so well with multi-schema queries.
So, I wonder:
- Is it possible to customize the name of
schema_migrations
that Phoenix maintains? - Or, if Phoenix needs its own Postrgres schema so that it can have its own
schema_migrations
, then how does the multi-schema story look currently?
Is there another solution I don’t know about?
EDIT: I found that Rails allows the table name to be changed. This is probably all I need:
3.8.5 config.active_record.schema_migrations_table_name
Lets you set a string to be used as the name of the schema migrations table.
EDIT 2: I found how to configure this in Phoenix:
:migration_source - Version numbers of migrations will be saved in a table named schema_migrations by default. You can configure the name of the table via:
config :app, App.Repo, migration_source: "my_migrations"