DROP TABLE IF EXISTS tng_media;
CREATE TABLE `tng_media` (
  `mediaID` int NOT NULL AUTO_INCREMENT,
  `mediatypeID` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `mediakey` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `gedcom` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `form` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  `path` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `datetaken` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `placetaken` text COLLATE utf8mb4_unicode_ci,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `owner` text COLLATE utf8mb4_unicode_ci,
  `thumbpath` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `alwayson` tinyint DEFAULT NULL,
  `map` text COLLATE utf8mb4_unicode_ci,
  `abspath` tinyint DEFAULT NULL,
  `status` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `showmap` smallint DEFAULT NULL,
  `cemeteryID` int DEFAULT NULL,
  `plot` text COLLATE utf8mb4_unicode_ci,
  `linktocem` tinyint DEFAULT NULL,
  `longitude` varchar(22) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `latitude` varchar(22) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `zoom` tinyint DEFAULT NULL,
  `width` smallint DEFAULT NULL,
  `height` smallint DEFAULT NULL,
  `bodytext` text COLLATE utf8mb4_unicode_ci,
  `usenl` tinyint DEFAULT NULL,
  `newwindow` tinyint DEFAULT NULL,
  `usecollfolder` tinyint DEFAULT NULL,
  `private` tinyint NOT NULL,
  `changedate` datetime NOT NULL,
  `changedby` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`mediaID`),
  UNIQUE KEY `mediakey` (`gedcom`,`mediakey`),
  KEY `mediatypeID` (`mediatypeID`),
  KEY `changedate` (`changedate`),
  KEY `description` (`description`(20)),
  KEY `headstones` (`cemeteryID`,`description`(20))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
