Episodes
Wolfgang Barth PRO said almost 5 years ago on Virtual Columns with JSON Data Types :

t.json doesn't work for me with rails 5.1.4, mysql2 0.4.10, and mariadb 10.2.10. I tried

 def change
    add_column :org_units, :ou_logo, :json
  end

after migration, schema.rb results in t.text:

    t.text "ou_logo", limit: 4294967295, collation: "utf8mb4_bin"

I expected t.json. Any ideas?

Wolfgang


David Kimura PRO said almost 5 years ago on Virtual Columns with JSON Data Types :

With MariaDB, it looks like the JSON data type was introduced in 10.2.7. However, instead of a JSON data type, it creates a LONGTEXT.

https://mariadb.com/kb/en/library/json-data-type/


Wolfgang Barth PRO said almost 5 years ago on Virtual Columns with JSON Data Types :

Thank you for the link. Mysql and JSON seems to be a trap for me. Most linux distributions migrate mysql to mariadb these days. Migrate data to mariadb needs an explicit dump and restore of the related tables or you change the type back to t.text in mysql.

I will go back use t.text an serialize for now.


Login to Comment