migrations icon indicating copy to clipboard operation
migrations copied to clipboard

Better support for procedure/function migrations.

Open hrach opened this issue 9 years ago • 4 comments

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.)

hrach avatar Nov 29 '16 14:11 hrach

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.

JanTvrdik avatar Nov 29 '16 17:11 JanTvrdik

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

hrach avatar Nov 29 '16 17:11 hrach

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.

JanTvrdik avatar Nov 29 '16 22:11 JanTvrdik

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

hrach avatar Nov 30 '16 07:11 hrach