我正在尝试进行此迁移:
def up
change_column :navigation_items, :access, 'text USING CAST(access AS text)', array: true
end
但是我收到此错误:
PG::SyntaxError: ERROR: syntax error at or near "["
LINE 1: ...ALTER COLUMN "access" TYPE text USING CAST(access AS text)[]
有谁知道如何确保在此迁移中将数组设置为 true?
语法应该是
change_column :navigation_items, :access, :text, array: true, default: []
假设您希望[]
列上的默认值