-
Notifications
You must be signed in to change notification settings - Fork 75
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
Possibly use raw SQL to convert to jsonb (maybe not always) #149
Comments
Its an interesting idea, we could potentially do something like this by default. I think its reasonable that some migrations will have to have manual intervention, but this seems like something we could potentially detect and provide a better default for. |
In this case, though, it would produce a jsonb string and not a map though. |
The migrations generator produced |
Yeah, but a string is a valid |
Ah! I see what you mean. I missed this because in my case I was storing No idea how to solve this properly besides generating warnings or comments during migration or when generating migrations. |
Yeah, I mean honestly thats what happens when you run the migrations, the data store tells you that you can't actually do that transition and have to figure out some other way to do what you want. I'm not sure if the migration generator should try to figure this one out since it can't know what the right answer is. |
I think we can't reliably do this kind of thing currently. Folks will need to edit the migrations themselves. |
awww shucks :( Well, it will probably affect a very small number of migrations anyway, and the solution is quite easy. |
Yeah, exactly. Its possible that in the future we could do it with something interactive in cases we can detect an issue, but the juice is unlikely to be worth the squeeze. |
Describe the bug
When converting a text column to jsonb,
The migration for the column is
I honestly can't tell you if this is always the case, but it looks like at least for text columns the conversion should include
USING <column name>::JSONB
If I'm not mistaken, the only way to do that with migrations is to use a raw
execute
To Reproduce
Expected behavior
Migration should run with no issue
Runtime
Elixir 1.14.4
Erlang/OTP 25 [erts-13.2] [source] [64-bit]
MacOS Ventura 13.4 (22F66)
{:ash, "~> 2.9.6"}
{:ash_postgres, "~> 1.3.25"}
The text was updated successfully, but these errors were encountered: