I'm following carrierwave documentation here to upload multiple images to my listing model. When, I used the command
rails g migration add_images_to_listings images:json
migration gets successfully created like this -
class AddImagesToListings < ActiveRecord::Migration
def change
add_column :listings, :images, :json
end
end
but running rake db:migrate throws a mysql syntax error
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'json'
at line 1: ALTER TABLE `listings` ADD `images` json/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `query'
I suspect this is because json data type is not supported with mysql. Is there some workaround?