CREATE TABLE IF NOT EXISTS `FILES` (
  `ID` bigint(20) NOT NULL,
  `ETAG` char(36) NOT NULL,
  `PREVIEW_ID` bigint(20) DEFAULT NULL,
  `CREATED_ON` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `CREATED_BY` bigint(20) NOT NULL,
  `METADATA_TYPE` ENUM('S3', 'EXTERNAL', 'PREVIEW') NOT NULL,
  `CONTENT_TYPE` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
  `CONTENT_SIZE` bigint(20) DEFAULT NULL,
  `CONTENT_MD5` varchar(100) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
  `BUCKET_NAME` varchar(100) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
  `NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
  `KEY` varchar(700) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
  `STORAGE_LOCATION_ID` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`ID`),
  KEY `KEY_KEY` (`KEY`),
  KEY `MD5_KEY` (`CONTENT_MD5`),
  CONSTRAINT `PREVEIW_ID_FK` FOREIGN KEY (`PREVIEW_ID`) REFERENCES `FILES` (`ID`) ON DELETE SET NULL,
  CONSTRAINT `FILE_CREATED_BY_FK` FOREIGN KEY (`CREATED_BY`) REFERENCES `JDOUSERGROUP` (`ID`) ON DELETE CASCADE,
  CONSTRAINT `FILE_STORAGE_LOCATION_ID_FK` FOREIGN KEY (`STORAGE_LOCATION_ID`) REFERENCES `STORAGE_LOCATION` (`ID`)
)

CREATE TABLE IF NOT EXISTS `FILES` (
  `ID` bigint(20) NOT NULL,
  `ETAG` char(36) NOT NULL,
  `PREVIEW_ID` bigint(20) DEFAULT NULL,
  `CREATED_ON` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `CREATED_BY` bigint(20) NOT NULL,
  `METADATA_TYPE` ENUM('S3', 'EXTERNAL', 'PREVIEW') NOT NULL,
  `CONTENT_TYPE` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
  `CONTENT_SIZE` bigint(20) DEFAULT NULL,
  `CONTENT_MD5` varchar(100) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
  `BUCKET_NAME` varchar(100) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
  `NAME` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
  `KEY` varchar(700) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
  `STORAGE_LOCATION_ID` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`ID`),
  KEY `KEY_KEY` (`KEY`),
  KEY `MD5_KEY` (`CONTENT_MD5`),
  CONSTRAINT `PREVEIW_ID_FK` FOREIGN KEY (`PREVIEW_ID`) REFERENCES `FILES` (`ID`) ON DELETE SET NULL,
  CONSTRAINT `FILE_CREATED_BY_FK` FOREIGN KEY (`CREATED_BY`) REFERENCES `JDOUSERGROUP` (`ID`) ON DELETE CASCADE,
  CONSTRAINT `FILE_STORAGE_LOCATION_ID_FK` FOREIGN KEY (`STORAGE_LOCATION_ID`) REFERENCES `STORAGE_LOCATION` (`ID`)
)

Revert "remove not null on created on"
Revert "remove not null on created on"

This reverts commit 49bee17fecc7b12f78b3f3591ca4b01369dae672.
