migrate icon indicating copy to clipboard operation
migrate copied to clipboard

Allow schema_migration prefix for multiple types of migrations

Open tjad opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. No. I'd like to be able to manage fixtures via database, and would like to use golang-migrate to do this. I have 2 folders db/migrations - for the general schema db/seed - for seed data (where my test fixtures live)

I may potentially want seed data for different environments such as test/staging/production

Describe the solution you'd like Add a column to the schema_migrations table, "prefix" or something. Then all existing functionality works the same, just for each prefix.

Describe alternatives you've considered None - or forking and DIY

Additional context None.

tjad avatar Jan 14 '22 05:01 tjad

Was just searching for the same thing. I think you can specify the migration table and have multiple tables for multiple migrations on the same database.

E.g. for mysql it's x-migrations-table in query, see readme: https://github.com/golang-migrate/migrate/blob/master/database/mysql/README.md

and then it's used in config: https://github.com/golang-migrate/migrate/blob/master/database/mysql/mysql.go#L41

rplnt avatar Mar 09 '22 17:03 rplnt