delimiter $$

CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET utf8 */$$

CREATE TABLE `document_content` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `VERSION_NR` int(11) NOT NULL,
  `NAME` mediumtext NOT NULL,
  `CONTENT_XML` longtext NOT NULL,
  `DOCUMENT_TEMPLATE_ID` int(11) NOT NULL,
  `OWNER` varchar(45) DEFAULT NULL,
  `sys_delete_status` char(1) NOT NULL DEFAULT 'N',
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID_UNIQUE` (`ID`),
  KEY `ID_DOCUMENT_TEMPLATE_idx` (`DOCUMENT_TEMPLATE_ID`),
  CONSTRAINT `ID_DOCUMENT_TEMPLATE` FOREIGN KEY (`DOCUMENT_TEMPLATE_ID`) REFERENCES `document_template` (`ID`) ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=196 DEFAULT CHARSET=utf8$$

CREATE TABLE `document_content_version` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `DOCUMENT_CONTENT_ID` int(11) NOT NULL,
  `VERSION_NR` int(11) NOT NULL,
  `CONTENT_XML` longtext NOT NULL,
  `CHANGER` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`ID`),
  KEY `ID_DOCUMENT_CONTENT_idx` (`DOCUMENT_CONTENT_ID`),
  CONSTRAINT `ID_DOCUMENT_CONTENT` FOREIGN KEY (`DOCUMENT_CONTENT_ID`) REFERENCES `document_content` (`ID`) ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=563 DEFAULT CHARSET=utf8$$

CREATE TABLE `document_template` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `NAME` mediumtext NOT NULL,
  `RULES` longtext,
  `TEMPLATE_XSD` longtext NOT NULL,
  `DESCRIPTION` mediumtext,
  `OWNER` varchar(45) DEFAULT NULL,
  `PERMISSIONS` longtext,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID_UNIQUE` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=utf8$$

