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

Better support for procedure/function migrations. #54

Open
hrach opened this issue Nov 29, 2016 · 4 comments
Open

Better support for procedure/function migrations. #54

hrach opened this issue Nov 29, 2016 · 4 comments

Comments

@hrach
Copy link
Member

hrach commented Nov 29, 2016

Migrations of procedures/functions are not done as delta migrations, but as a drop & create (replace) statements. For this reason, it's really hard to track the changes - since there are many "copies" of the function and git diff doesn't visualize the different between these coppies.

I propose introducing support for a file, which may be modified and would be deployed (executed) if the hash changes. The usage of this behaviour would have only one restriction - the procedure/function cannot be used in migration. (In such case, the migration would have to "copy" the "old" function to custom temporary function.)

@JanTvrdik
Copy link
Member

JanTvrdik commented Nov 29, 2016

I agree with the problem, but not so much with the proposed solution. I think that better solution is to have a single directory where you store the procedures and a command which generates migrations if anything in the directory changes.

@hrach
Copy link
Member Author

hrach commented Nov 29, 2016

What is the added value with your solution? The needed "sync" step is imo a downside.

@JanTvrdik
Copy link
Member

You can auto sync when calling continue, if the sync step is too annoying. The added value is that the core (both in sense of ideas and actual code) of migrations remains intact.

@hrach
Copy link
Member Author

hrach commented Nov 30, 2016

It seems to me that it's musch easier to run there two commands than arguing about implementation in nextras:

php console.php migrations:continue 
psql databasename < migrations/plfunctions.sql

We may introduce

php console.php migrations:import

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

No branches or pull requests

2 participants