Mysql database question. There is system with objects(Domains). Each domain has own table. All objects has unique 16 varchar id – guid
CREATE TABLE `guid` (
`guid` varchar(16) NOT NULL,
`obj_type` varchar(45) NOT NULL,
`obj_id` varchar(45) NOT NULL,
`actived` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (`guid`)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `product` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(150) NOT NULL,
/*....*/
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `catalog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(150) NOT NULL,
/*....*/
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
I would like connect table guid(fields: obj_type, obj_id) and domain tables(field:id) through foreign key.
Foreign key relationships involve a parent table that holds the central data values, and a child table with identical values pointing back to its parent. The FOREIGN KEY clause is specified in the child table. The parent and child tables must both be InnoDB tables. They must not be TEMPORARY tables.