You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying out this gem, and I got this error when trying to reverse the migrations so that I could work on a different branch.
== 20240817025553 ChangeCursorToString: reverting =============================
-- change_table(:maintenance_tasks_runs)
bin/rails aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)
PG::DatatypeMismatch: ERROR: column "cursor" cannot be cast automatically to type bigint
HINT: You might need to specify "USING cursor::bigint".
/app/db/migrate/20240817025553_change_cursor_to_string.maintenance_tasks.rb:16:in `block in down'
/app/db/migrate/20240817025553_change_cursor_to_string.maintenance_tasks.rb:15:in `down'
Caused by:
ActiveRecord::StatementInvalid: PG::DatatypeMismatch: ERROR: column "cursor" cannot be cast automatically to type bigint (ActiveRecord::StatementInvalid)
HINT: You might need to specify "USING cursor::bigint".
/app/db/migrate/20240817025553_change_cursor_to_string.maintenance_tasks.rb:16:in `block in down'
/app/db/migrate/20240817025553_change_cursor_to_string.maintenance_tasks.rb:15:in `down'
I think maybe the way to fix this would be to change it to this:
defdownchange_table(:maintenance_tasks_runs)do |t|
t.change(:cursor,"bigint USING cursor::bigint")endend
I was a bit confused about how to apply the hint but then I found this https://stackoverflow.com/a/44132110 but at least in this case I don't think it's necessary to use the CAST function explicitly. I expect that it's largely moot anyway since people probably won't be reversing this in production, only in development environments where they're testing it out.
Thanks!
The text was updated successfully, but these errors were encountered:
ibrahima
added a commit
to ibrahima/maintenance_tasks
that referenced
this issue
Aug 19, 2024
This issue has been marked as stale because it has not been commented on in two months.
Please reply in order to keep the issue open. Otherwise, it will close in 14 days.
Thank you for contributing!
I'm trying out this gem, and I got this error when trying to reverse the migrations so that I could work on a different branch.
I think maybe the way to fix this would be to change it to this:
I was a bit confused about how to apply the hint but then I found this https://stackoverflow.com/a/44132110 but at least in this case I don't think it's necessary to use the CAST function explicitly. I expect that it's largely moot anyway since people probably won't be reversing this in production, only in development environments where they're testing it out.
Thanks!
The text was updated successfully, but these errors were encountered: