-
Notifications
You must be signed in to change notification settings - Fork 15
Improve database reloader #2
Comments
yes, i was looking into using it but for migration from dev to production, but the usecase here is also good. If you can get this approach working then perfect. What i am not sure will work is the fact that in the project structure, in sql files, i use Anyway, you know the thing we are trying to accomplish, "any change in the sql files is immediately reflected in the db, then the containers are refreshed to reload the new schema". |
I've been trying working the sub0_kickstart example with
The list is not comprehensive I bet there'll be more errors. I think |
Patching apgdiff java parser may be too much of an effort, I think there's a better solution for this. Instead of a custom parser for pg sql I thought of reusing pg parser, there's is an official guide for this For our use case I'd have to include ddl and dcl statements, these are also included in pg parser.c, maybe I could patch libpg_query or see if I can reuse pg code in another way. The other issue about psql slash commands, I've seen pg code and it handles in a more simpler way separate from the parser.c, I think just the This It's more of a long term project though but I think it's feasible and it would not only benefit the devtools but solve more complex migration issues, if you think is worth it I could research a bit more and then do a small proof of concept and see where it goes. |
a good pgdiff that understands all the commands is good and probably will be easyer to write in haskell where you have custom types and easey parsing but it's a complex project so let's put tht on hold, let's get the devtools working with the curent approach of resetting (which could be made faster probably with some tricks) |
Seeing the amount of errors |
I don't know but reloading a schema with a smal dataset is not a huge deal, it should not take more then 10s (my old laptop, the kickstart is only 2 s)
But let's leave this for later. Console now :)
… On 13 Apr 2017, at 17:06, Steve Chávez ***@***.***> wrote:
Seeing the amount of errors apgdiff throws with the kickstart I think that it'll be better to not include it in the devtools console, what other tricks could make the resetting faster?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Right now the sub0_devtools tries to run the user sql scripts and recreates the db in case of failure, this cycle is slower on later stages of development and in projects with a considerable size of master data.
I have a modest dataset related to some local GIS app that takes 12 seconds to recreate.
For now I propose using apgdiff, with this migrations are easier, say we have:
To migrate from
v1.sql
tov2.sql
we can do this:This outputs:
To reverse from
v2.sql
tov1.sql
:This outputs:
I think this tool approach for migrations is better than the ones that rely on convention and discipline like sqitch or pgrebase.
The thing is
apgdiff
only operates on sql files, so I could do apg_dump -s
on the user database and just runapgdiff
with this and the user current db defined in his folder structure then apply the diff.The text was updated successfully, but these errors were encountered: