Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After migrations event #1427

Closed
zeleznypa opened this issue Aug 20, 2018 · 3 comments
Closed

After migrations event #1427

zeleznypa opened this issue Aug 20, 2018 · 3 comments

Comments

@zeleznypa
Copy link

We are looking for something like "After all migrations event", where we need to call something like "Rebuild and check all DB procedure".

Will it be possible to add this feature please?

@rquadling
Copy link
Collaborator

I have a repeatables process which does this. I was originally looking to do this in Phinx, but the codebase at the time didn't make it too easy to fit in (my opinion).

The main issues our team had was that migrations are a very bad fit for repeatables (stored procedures, views, functions, triggers, etc. DDLs). Especially in a multi-developer, multi-branch environment. Repeatables cannot easily be delta'd, so you cannot say add this column to a view, or change this line of code in a trigger. Only the complete view, the complete trigger can be sent to the SQL server.

We found that whilst migrations use a version number in their own logic, versioning of repeatables is done in source control. This resolves all the issues we experienced - so far.

Rolling back requires a rollback of the source code, but invariably the old form of a view requires the older code, so it all makes sense in one way.

For your issue though, you could use your shell to do the work. Something along the lines of ...

phinx migrate && your-command

If Phinx executes successfully, then your-command will run. If Phinx fails, your-command will not be run.

@zeleznypa
Copy link
Author

@rquadling You have absolutely true, but it is very easy to forgot add && your-command and also it is also uncomfortable. Sure that you can make your own migrate.sh or composer task for that, but...

I think that it can be useful to have something like "after all migrations is done, run this script" event, where you can use the power of Phinx and his configuration to run "Deploy and rebuild all packages and procedures" nicely by just one simple command phinx migrate :)))

@rquadling
Copy link
Collaborator

OOI, #1382 may be of interest! (Even after I had my own use case for this feature, I'd forgotten about it!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants