How can solve JSON column in H2

前端 未结 10 1843
隐瞒了意图╮
隐瞒了意图╮ 2020-12-24 13:39

I use in application MySQL 5.7 and I have JSON columns. When I try running my integration tests don\'t work because the H2 database can\'t create the table. This is the erro

10条回答
  •  囚心锁ツ
    2020-12-24 13:54

    I just came across this problem working with the JSONB column type - the binary version of the JSON type, which doesn't map to TEXT.

    For future reference, you can define a custom type in H2 using CREATE DOMAIN, as follows:

    CREATE domain IF NOT EXISTS jsonb AS other;
    

    This seemed to work for me, and allowed me to successfully test my code against the entity.

    Source: https://objectpartners.com/2015/05/26/grails-postgresql-9-4-and-jsonb/

提交回复
热议问题