0

I am attempting to db:migrate:reset and encountered this error:

rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::SyntaxError: ERROR:  syntax error at or near "USING"
LINE 1: SELECT 'integer[] USING ARRAY[pdf_page_number]::INTEGER...
              ^
CONTEXT:  invalid type name "integer[] USING ARRAY[pdf_page_number]::INTEGER[][]"


The migration file causing this error:

class ChangeCartItemsPageNumbersToArray < ActiveRecord::Migration[5.2]
  def up
    change_column :cart_items, :pdf_page_number, 'integer[] USING ARRAY[pdf_page_number]::INTEGER[]', array: true, null: false, default: []
  end
end

Thanks!

1 Answer 1

1

This fixed it:

change_column :cart_items, :pdf_page_number, :integer, using: 'ARRAY[pdf_page_number]::INTEGER[]', array: true, null: false, default: []

This question/answer very helpful

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.