CREATE TABLE IF NOT EXISTS NUE_INDEX_TAG_ASSIGN
(
	NAME		VARCHAR(255)					NOT NULL	COMMENT 'タグ名',
	TOPIC_ID	CHAR(36) CHARACTER SET ascii	NOT NULL	COMMENT '記事ID',
	ENTITY_ID	CHAR(36) CHARACTER SET ascii	NOT NULL	COMMENT '実体ID',
	PRIMARY KEY (NAME, TOPIC_ID),
	FOREIGN KEY (NAME) REFERENCES NUE_INDEX_TAG(NAME) ON UPDATE CASCADE ON DELETE CASCADE,
	FOREIGN KEY (TOPIC_ID) REFERENCES NUE_ENTITIES(ID) ON UPDATE CASCADE ON DELETE CASCADE,
	FOREIGN KEY (ENTITY_ID) REFERENCES NUE_ENTITIES(ID) ON UPDATE CASCADE ON DELETE CASCADE
)
ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='タグ割り当て';
