
CREATE DATABASE /*!32312 IF NOT EXISTS*/`empty` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE `empty`;

CREATE TABLE `user` (
  `ID` bigint(20) NOT NULL AUTO_INCREMENT,
  `NAME` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='A sample user table.';

CREATE TABLE `sample` (
  `ID` bigint(20) NOT NULL AUTO_INCREMENT,
  `USER_FK` bigint(20) NOT NULL,
  `VALUE` text,
  `TIME` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `version` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  UNIQUE KEY `PK_SAMPLE` (`ID`),
  KEY `FK_USER` (`USER_FK`),
  CONSTRAINT `FK_USER` FOREIGN KEY (`USER_FK`) REFERENCES `user` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='A sample table.';
