-
Notifications
You must be signed in to change notification settings - Fork 152
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
Change json datatype to jsonb #257
Conversation
Transitioning to Not sure wether we should keep falling back to /cc @jipiboily |
Wouldn't it be less intrusive to only change the datatype of new migrations instead of migrating every existing args column to |
@clemensg this change only makes sense if we think One should still be able to skip the migration if one pleases but we should make it easy to follow along. |
OK, good point. But then we should also migrate old I mean:
Or:
|
I don't know the details but it depends how easily we can migrate a column. I'm expecting that PostgreSQL allows us to Currently I'm thinking about a simple migration which checks for @clemensg can you investigate? |
@senny Yes. |
af42013
to
9fb7821
Compare
@senny I updated the PR. Btw.: In the update_to_3_2_0.sql file, I also set the args column to Regarding your concerns about the |
821db0d
to
855619b
Compare
Could you add a corresponding downgrade script? Also, the Rails generator needs to be updated to generate an upgrade migration. See this PR for details https://github.com/QueueClassic/queue_classic/pull/217/files#diff-e455d018c3ab4c611d786db00a9c1458R1 |
855619b
to
12c109e
Compare
Yes, I updated the PR. |
@clemensg awesome 💛 @jipiboily thoughts? |
🐌 |
@clemensg please be respectful with your comments. We are investing our own personal time for Open Source projects. I understand that delays can be frustrating at times but please remember that this is on our list and sometimes we can't drop everything to get it finished. Thank you for your understanding. |
Hey, I don't think a (cute) snail emoji is disrespectful.. do you really think so? Just to clarify: I meant "Any blockers? Anything left to do before this can get merged?" Of course you are investing your own personal time, so am I. |
@clemensg I'm saying a snail emoji could easily be interpreted as "why is this moving so slow?". Also bumping just leads to a bigger email flood. If you have big repositories like |
This sounds good generally speaking. My only worry is that so far we didn't change the column type at all. We're still using text. It might be perfectly fine but it could also break things for some people, like for queue_classic_admin or other things built around it. This is quite unlikely and should be easy to fix though so I'm 👍. |
I was thinking about this some more. Maybe it's better to be conservative and don't upgrade existing databases at all. We can add a section to the README explaining how a user could perform the upgrade. This way new users get @clemensg what do you think about that approach? |
@senny This was my initial approach in this PR. That's why I asked Wouldn't it be less intrusive to only change the datatype of new migrations instead of migrating every existing args column to jsonb? So yes, I think so too, we should go for the more conservative approach. I'll change / revert the PR 😉 |
12c109e
to
c988d96
Compare
@clemensg sorry for the roundtrip 😓. Thanks for helping out and adjusting the PR. |
No problem. Sometimes it's worth thinking about a problem for a longer time. |
mmm, I remember a test that failed for a longer period of time but If I remember correctly I added a |
Looks like another test is asking for |
…son or text. Signed-off-by: Clemens Gruber <[email protected]>
c988d96
to
520ff8a
Compare
@senny Interesting, now it's green after I re-triggered the Travis build. |
yea, seems to be flapping. Maybe we get various speeds from Travis when running the build. Due to server load or something like that. I'll try to look at it in the near future. |
Worked fine when testing on my machine. @clemensg thanks for your patience and the roundtrip 💛! |
Hi,
as the json datatype needs to be parsed over and over again and queue_classic does not make assumptions about the ordering of args' keys, a switch to jsonb seems reasonable to me.
Quote from the PostgreSQL docs: In general, most applications should prefer to store JSON data as jsonb, unless there are quite specialized needs, such as legacy assumptions about ordering of object keys.
http://www.postgresql.org/docs/current/static/datatype-json.html
In case somebody uses 9.3 or earlier, I think it is OK to fall back to text and not check for both jsonb and json. With text we have at least no DB performance penalty, but json is reparsed with every insert. jsonb is parsed only once.