DROP TABLE IF EXISTS items;
DROP TABLE IF EXISTS attributes;
SET NAMES utf8mb4;
CREATE TABLE attributes (
id varchar(255) PRIMARY KEY,
name varchar(255),
value varchar(255)
) DEFAULT CHARSET=utf8mb4;
CREATE TABLE items (
id int PRIMARY KEY AUTO_INCREMENT,
attributes text DEFAULT NULL COMMENT "flags 'COLUMN_VECTOR', groonga_type 'attributes'"
) DEFAULT CHARSET=utf8mb4;
INSERT INTO items (attributes)
VALUES ('[{"_key": "item-1-1", "name": "color", "value": "white"},
            {"_key": "item-1-2", "name": "size",  "value": "big"}]');
INSERT INTO items (attributes)
VALUES ('[{"_key": "item-2-1", "name": "color", "value": "black"}]');
INSERT INTO items (attributes) VALUES ('');
SELECT * FROM attributes;
id	name	value
ITEM-1-1	color	white
ITEM-1-2	size	big
ITEM-2-1	color	black
INSERT INTO items (attributes)
VALUES ('["ITEM-1-1","ITEM-1-2"]');
INSERT INTO items (attributes)
VALUES ('["ITEM-2-1"]');
DROP TABLE items;
DROP TABLE attributes;
