CREATE TABLE `fielddef` (
`Field_ID` int(11) NOT NULL DEFAULT '0',
`TID` int(11) NOT NULL DEFAULT '0',
`IsCustom` tinyint(1) NOT NULL DEFAULT '0',
`Name` varchar(64) NOT NULL DEFAULT '',
`ExtID` int(11) NOT NULL DEFAULT '0',
`IntID` int(11) NOT NULL DEFAULT '0',
`Priority` int(11) NOT NULL DEFAULT '0',
`IsIndexable` tinyint(1) NOT NULL DEFAULT '0',
`IsIndexed` tinyint(1) NOT NULL DEFAULT '0',
`IndexID` int(11) NOT NULL DEFAULT '0',
`IsMultiValued` tinyint(1) NOT NULL DEFAULT '0',
`UserFlags` int(11) NOT NULL DEFAULT '0',
`ClassID` tinyblob NOT NULL,
`MultiValueDups` int(11) NOT NULL DEFAULT '0',
`MultipleKeys` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`Field_ID`),
KEY `IX_FieldDef__1` (`TID`),
KEY `wb_1` (`Field_ID`,`Name`),
CONSTRAINT `FK_FieldDef__1` FOREIGN KEY (`TID`) REFERENCES `tabledef` (`TID`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `customdata` (
`Field_ID` int(11) NOT NULL DEFAULT '0',
`Record_ID` int(11) NOT NULL DEFAULT '0',
`StringValue` varchar(249) DEFAULT NULL,
`LongStringValue` longtext,
`IntValue` int(11) DEFAULT NULL,
`DecimalValue` decimal(22,8) DEFAULT NULL,
`DateTimeValue` datetime DEFAULT NULL,
`ValueOrder` int(11) DEFAULT NULL,
KEY `IX_CustomData__1` (`Field_ID`),
KEY `IX_CustomData__2` (`Record_ID`,`Field_ID`),
KEY `wb_stringvalue` (`StringValue`),
KEY `IX_CustomData__3` (`StringValue`),
KEY `IX_CustomData__4` (`IntValue`),
KEY `IX_CustomData__5` (`DecimalValue`),
KEY `IX_CustomData__6` (`DateTimeValue`),
CONSTRAINT `FK_CustomData__1` FOREIGN KEY (`Field_ID`) REFERENCES `fielddef` (`Field_ID`) ON DELETE CASCADE,
CONSTRAINT `FK_CustomData__2` FOREIGN KEY (`Record_ID`) REFERENCES `item_table` (`Record_ID`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;