jackc / tern

The SQL Fan's Migrator
MIT License
925 stars 68 forks source link

Can we specify migration metadata table name? #23

Closed aleyrizvi closed 3 years ago

aleyrizvi commented 4 years ago

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?

jackc commented 4 years ago

Yes, you can specify version_table in your config.

aleyrizvi commented 4 years ago

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

aleyrizvi commented 4 years ago

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

aleyrizvi commented 4 years ago

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.

jackc commented 4 years ago

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.

aleyrizvi commented 4 years ago

Would you recommend:

jackc commented 4 years ago

That would be a reasonable approach.