jackc / tern

The SQL Fan's Migrator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can we specify migration metadata table name?

aleyrizvi opened this issue · comments

Hi,
we have 3 microservices and I would like to use tern with them. They share same database but different schemas and tables.

Can we specify the tablename used by tern to record migrations?

Yes, you can specify version_table in your config.

Thanks, Is it okay if I create a pull request for readme and include that with description?

nevermind, its already there. Since its not highlighted, I missed that.

version_table = public.schema_version

Is public the schema name?

What if we want to use another schema but its not available yet? We will be adding schema in our migration.

public is the schema name.

Adding the schema in which the version table will be contained in a migration is a bit of a chicken and the egg situation. The first thing tern does is inspect that table to see what version it is at. If it doesn't find it then it creates it. I suppose it could also automatically create the schema too... But I'm a bit dubious as to the wisdom of doing that automagically.

Would you recommend:

  • We create schemas within our migrations
  • All version tables stays inside public schema (with their respective names)

That would be a reasonable approach.