db-migrate / node-db-migrate

Database migration framework for node
Other
2.32k stars 360 forks source link

Run the same migration on multiple databases #647

Closed ymhr closed 5 years ago

ymhr commented 5 years ago

I'm submitting a...

Current behavior

You can run a migration against a specific database.

Expected behavior

It would be good for some applications, such as those with multi-tenancy, to be able to run the same migration on separate databases. My application, for example, has each client in their own database, but the structure is the same across each. I currently cannot find a better solution than adding a scope for each and duplicating the migration file.

Perhaps this could take the form of having an array of database names inside database.json?

I have tried to write a script to do this for me, since my databases are somewhat dynamic but with predictable names, but the script will not run when database.json is not present, and unfortunately it only inserts into the migrations table of the db listed in database.json if it is present.

Of course, if this feature already exists and I have just missed it, I would be very appreciative if someone could tell me I'm an idiot point me in the right direction.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.