DROP TABLE IF EXISTS tng_addresses;
CREATE TABLE `tng_addresses` (
  `addressID` int(11) NOT NULL AUTO_INCREMENT,
  `address1` varchar(64) NOT NULL,
  `address2` varchar(64) NOT NULL,
  `city` varchar(64) NOT NULL,
  `state` varchar(64) NOT NULL,
  `zip` varchar(10) NOT NULL,
  `country` varchar(64) NOT NULL,
  `www` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `phone` varchar(30) NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  PRIMARY KEY (`addressID`),
  KEY `address` (`gedcom`,`country`,`state`,`city`)
) ENGINE=MyISAM AUTO_INCREMENT=29 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_albums;
CREATE TABLE `tng_albums` (
  `albumID` int(11) NOT NULL AUTO_INCREMENT,
  `albumname` varchar(100) NOT NULL,
  `description` text,
  `alwayson` tinyint(4) DEFAULT NULL,
  `keywords` text,
  `active` tinyint(4) NOT NULL,
  PRIMARY KEY (`albumID`),
  KEY `albumname` (`albumname`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_albumlinks;
CREATE TABLE `tng_albumlinks` (
  `albumlinkID` int(11) NOT NULL AUTO_INCREMENT,
  `albumID` int(11) NOT NULL,
  `mediaID` int(11) NOT NULL,
  `ordernum` int(11) DEFAULT NULL,
  `defphoto` varchar(1) NOT NULL,
  PRIMARY KEY (`albumlinkID`),
  KEY `albumID` (`albumID`,`ordernum`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_albumplinks;
CREATE TABLE `tng_albumplinks` (
  `alinkID` int(11) NOT NULL AUTO_INCREMENT,
  `gedcom` varchar(20) NOT NULL,
  `linktype` char(1) NOT NULL,
  `entityID` varchar(100) NOT NULL,
  `eventID` varchar(10) NOT NULL,
  `albumID` int(11) NOT NULL,
  `ordernum` float NOT NULL,
  PRIMARY KEY (`alinkID`),
  UNIQUE KEY `alinkID` (`gedcom`,`entityID`,`albumID`),
  KEY `entityID` (`gedcom`,`entityID`,`ordernum`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_associations;
CREATE TABLE `tng_associations` (
  `assocID` int(11) NOT NULL AUTO_INCREMENT,
  `gedcom` varchar(20) NOT NULL,
  `personID` varchar(22) NOT NULL,
  `passocID` varchar(22) NOT NULL,
  `reltype` varchar(1) NOT NULL,
  `relationship` varchar(75) NOT NULL,
  PRIMARY KEY (`assocID`),
  KEY `assoc` (`gedcom`,`personID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_branches;
CREATE TABLE `tng_branches` (
  `branch` varchar(20) NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  `description` varchar(128) NOT NULL,
  `personID` varchar(22) NOT NULL,
  `agens` int(11) NOT NULL,
  `dgens` int(11) NOT NULL,
  `dagens` int(11) NOT NULL,
  `inclspouses` tinyint(4) NOT NULL,
  `action` tinyint(4) NOT NULL,
  PRIMARY KEY (`gedcom`,`branch`),
  KEY `description` (`gedcom`,`description`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_branchlinks;
CREATE TABLE `tng_branchlinks` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `branch` varchar(20) NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  `persfamID` varchar(22) NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `branch` (`gedcom`,`branch`,`persfamID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_cemeteries;
CREATE TABLE `tng_cemeteries` (
  `cemeteryID` int(11) NOT NULL AUTO_INCREMENT,
  `cemname` varchar(64) NOT NULL,
  `maplink` varchar(255) NOT NULL,
  `city` varchar(64) DEFAULT NULL,
  `county` varchar(64) DEFAULT NULL,
  `state` varchar(64) DEFAULT NULL,
  `country` varchar(64) DEFAULT NULL,
  `longitude` varchar(22) DEFAULT NULL,
  `latitude` varchar(22) DEFAULT NULL,
  `zoom` tinyint(4) DEFAULT NULL,
  `notes` text,
  `place` varchar(248) NOT NULL,
  PRIMARY KEY (`cemeteryID`),
  KEY `cemname` (`cemname`),
  KEY `place` (`place`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_people;
CREATE TABLE `tng_people` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `gedcom` varchar(20) NOT NULL,
  `personID` varchar(22) NOT NULL,
  `lnprefix` varchar(25) NOT NULL,
  `lastname` varchar(127) NOT NULL,
  `firstname` varchar(127) NOT NULL,
  `birthdate` varchar(50) NOT NULL,
  `birthdatetr` date NOT NULL,
  `sex` varchar(25) NOT NULL,
  `birthplace` text NOT NULL,
  `deathdate` varchar(50) NOT NULL,
  `deathdatetr` date NOT NULL,
  `deathplace` text NOT NULL,
  `altbirthtype` varchar(5) NOT NULL,
  `altbirthdate` varchar(50) NOT NULL,
  `altbirthdatetr` date NOT NULL,
  `altbirthplace` text NOT NULL,
  `burialdate` varchar(50) NOT NULL,
  `burialdatetr` date NOT NULL,
  `burialplace` text NOT NULL,
  `burialtype` tinyint(4) NOT NULL,
  `baptdate` varchar(50) NOT NULL,
  `baptdatetr` date NOT NULL,
  `baptplace` text NOT NULL,
  `confdate` varchar(50) NOT NULL,
  `confdatetr` date NOT NULL,
  `confplace` text NOT NULL,
  `initdate` varchar(50) NOT NULL,
  `initdatetr` date NOT NULL,
  `initplace` text NOT NULL,
  `endldate` varchar(50) NOT NULL,
  `endldatetr` date NOT NULL,
  `endlplace` text NOT NULL,
  `changedate` datetime NOT NULL,
  `nickname` text NOT NULL,
  `title` tinytext NOT NULL,
  `prefix` tinytext NOT NULL,
  `suffix` tinytext NOT NULL,
  `nameorder` tinyint(4) NOT NULL,
  `famc` varchar(22) NOT NULL,
  `metaphone` varchar(15) NOT NULL,
  `living` tinyint(4) NOT NULL,
  `private` tinyint(4) NOT NULL,
  `branch` varchar(512) NOT NULL,
  `changedby` varchar(100) NOT NULL,
  `edituser` varchar(100) NOT NULL,
  `edittime` int(11) NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `gedpers` (`gedcom`,`personID`),
  KEY `lastname` (`lastname`,`firstname`),
  KEY `firstname` (`firstname`),
  KEY `gedlast` (`gedcom`,`lastname`,`firstname`),
  KEY `gedfirst` (`gedcom`,`firstname`),
  KEY `birthplace` (`birthplace`(20)),
  KEY `altbirthplace` (`altbirthplace`(20)),
  KEY `deathplace` (`deathplace`(20)),
  KEY `burialplace` (`burialplace`(20)),
  KEY `baptplace` (`baptplace`(20)),
  KEY `confplace` (`confplace`(20)),
  KEY `initplace` (`initplace`(20)),
  KEY `endlplace` (`endlplace`(20)),
  KEY `changedate` (`changedate`)
) ENGINE=MyISAM AUTO_INCREMENT=3328 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_families;
CREATE TABLE `tng_families` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `gedcom` varchar(20) NOT NULL,
  `familyID` varchar(22) NOT NULL,
  `husband` varchar(22) NOT NULL,
  `wife` varchar(22) NOT NULL,
  `marrdate` varchar(50) NOT NULL,
  `marrdatetr` date NOT NULL,
  `marrplace` text NOT NULL,
  `marrtype` varchar(90) NOT NULL,
  `divdate` varchar(50) NOT NULL,
  `divdatetr` date NOT NULL,
  `divplace` text NOT NULL,
  `status` varchar(20) NOT NULL,
  `sealdate` varchar(50) NOT NULL,
  `sealdatetr` date NOT NULL,
  `sealplace` text NOT NULL,
  `husborder` tinyint(4) NOT NULL,
  `wifeorder` tinyint(4) NOT NULL,
  `changedate` datetime NOT NULL,
  `living` tinyint(4) NOT NULL,
  `private` tinyint(4) NOT NULL,
  `branch` varchar(512) NOT NULL,
  `changedby` varchar(100) NOT NULL,
  `edituser` varchar(100) NOT NULL,
  `edittime` int(11) NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `familyID` (`gedcom`,`familyID`),
  KEY `husband` (`gedcom`,`husband`),
  KEY `wife` (`gedcom`,`wife`),
  KEY `marrplace` (`marrplace`(20)),
  KEY `divplace` (`divplace`(20)),
  KEY `changedate` (`changedate`)
) ENGINE=MyISAM AUTO_INCREMENT=972 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_children;
CREATE TABLE `tng_children` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `gedcom` varchar(20) NOT NULL,
  `familyID` varchar(22) NOT NULL,
  `personID` varchar(22) NOT NULL,
  `frel` varchar(20) NOT NULL,
  `mrel` varchar(20) NOT NULL,
  `sealdate` varchar(50) NOT NULL,
  `sealdatetr` date NOT NULL,
  `sealplace` text NOT NULL,
  `haskids` tinyint(4) NOT NULL,
  `ordernum` smallint(6) NOT NULL,
  `parentorder` tinyint(4) NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `familyID` (`gedcom`,`familyID`,`personID`),
  KEY `personID` (`gedcom`,`personID`)
) ENGINE=MyISAM AUTO_INCREMENT=2353 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_image_tags;
CREATE TABLE `tng_image_tags` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `mediaID` int(11) NOT NULL,
  `rtop` int(11) NOT NULL,
  `rleft` int(11) NOT NULL,
  `rheight` int(11) NOT NULL,
  `rwidth` int(11) NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  `linktype` char(1) NOT NULL,
  `persfamID` varchar(100) NOT NULL,
  `label` varchar(64) NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `mediaID` (`mediaID`,`gedcom`,`persfamID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_languages;
CREATE TABLE `tng_languages` (
  `languageID` smallint(6) NOT NULL AUTO_INCREMENT,
  `display` varchar(100) NOT NULL,
  `folder` varchar(50) NOT NULL,
  `charset` varchar(30) NOT NULL,
  `norels` varchar(1) NOT NULL,
  PRIMARY KEY (`languageID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_places;
CREATE TABLE `tng_places` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `gedcom` varchar(20) NOT NULL,
  `place` varchar(248) NOT NULL,
  `longitude` varchar(22) DEFAULT NULL,
  `latitude` varchar(22) DEFAULT NULL,
  `zoom` tinyint(4) DEFAULT NULL,
  `placelevel` tinyint(4) DEFAULT NULL,
  `temple` tinyint(4) NOT NULL,
  `geoignore` tinyint(4) NOT NULL,
  `notes` text,
  `changedate` datetime NOT NULL,
  `changedby` varchar(100) NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `place` (`gedcom`,`place`),
  KEY `temple` (`temple`,`gedcom`,`place`)
) ENGINE=MyISAM AUTO_INCREMENT=5341 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_states;
CREATE TABLE `tng_states` (
  `state` varchar(64) NOT NULL,
  PRIMARY KEY (`state`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_countries;
CREATE TABLE `tng_countries` (
  `country` varchar(64) NOT NULL,
  PRIMARY KEY (`country`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_sources;
CREATE TABLE `tng_sources` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `gedcom` varchar(20) NOT NULL,
  `sourceID` varchar(22) NOT NULL,
  `callnum` varchar(120) NOT NULL,
  `type` varchar(20) DEFAULT NULL,
  `title` text NOT NULL,
  `author` text NOT NULL,
  `publisher` text NOT NULL,
  `other` text NOT NULL,
  `shorttitle` text NOT NULL,
  `comments` text,
  `actualtext` text NOT NULL,
  `repoID` varchar(22) NOT NULL,
  `changedate` datetime NOT NULL,
  `changedby` varchar(100) NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `sourceID` (`gedcom`,`sourceID`),
  KEY `changedate` (`changedate`),
  FULLTEXT KEY `sourcetext` (`actualtext`)
) ENGINE=MyISAM AUTO_INCREMENT=3190 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_repositories;
CREATE TABLE `tng_repositories` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `repoID` varchar(22) NOT NULL,
  `reponame` varchar(90) NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  `addressID` int(11) NOT NULL,
  `changedate` datetime NOT NULL,
  `changedby` varchar(100) NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `repoID` (`gedcom`,`repoID`),
  KEY `reponame` (`reponame`)
) ENGINE=MyISAM AUTO_INCREMENT=48 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_citations;
CREATE TABLE `tng_citations` (
  `citationID` int(11) NOT NULL AUTO_INCREMENT,
  `gedcom` varchar(20) NOT NULL,
  `persfamID` varchar(22) NOT NULL,
  `eventID` varchar(10) NOT NULL,
  `sourceID` varchar(22) NOT NULL,
  `ordernum` float NOT NULL,
  `description` text NOT NULL,
  `citedate` varchar(50) NOT NULL,
  `citedatetr` date NOT NULL,
  `citetext` text NOT NULL,
  `page` text NOT NULL,
  `quay` varchar(2) NOT NULL,
  `note` text NOT NULL,
  PRIMARY KEY (`citationID`),
  KEY `citation` (`gedcom`,`persfamID`,`eventID`,`sourceID`,`description`(20))
) ENGINE=MyISAM AUTO_INCREMENT=10083 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_reports;
CREATE TABLE `tng_reports` (
  `reportID` int(11) NOT NULL AUTO_INCREMENT,
  `reportname` varchar(80) NOT NULL,
  `reportdesc` text NOT NULL,
  `ranking` int(11) NOT NULL,
  `display` text NOT NULL,
  `criteria` text NOT NULL,
  `orderby` text NOT NULL,
  `sqlselect` text NOT NULL,
  `active` tinyint(4) NOT NULL,
  PRIMARY KEY (`reportID`),
  KEY `reportname` (`reportname`),
  KEY `ranking` (`ranking`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_events;
CREATE TABLE `tng_events` (
  `eventID` int(11) NOT NULL AUTO_INCREMENT,
  `gedcom` varchar(20) NOT NULL,
  `persfamID` varchar(22) NOT NULL,
  `eventtypeID` int(11) NOT NULL,
  `eventdate` varchar(50) NOT NULL,
  `eventdatetr` date NOT NULL,
  `eventplace` text NOT NULL,
  `age` varchar(12) NOT NULL,
  `agency` varchar(120) NOT NULL,
  `cause` varchar(90) NOT NULL,
  `addressID` varchar(10) NOT NULL,
  `parenttag` varchar(10) NOT NULL,
  `info` text NOT NULL,
  PRIMARY KEY (`eventID`),
  KEY `persfamID` (`gedcom`,`persfamID`),
  KEY `eventplace` (`gedcom`,`eventplace`(20))
) ENGINE=MyISAM AUTO_INCREMENT=1369 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_eventtypes;
CREATE TABLE `tng_eventtypes` (
  `eventtypeID` int(11) NOT NULL AUTO_INCREMENT,
  `tag` varchar(10) NOT NULL,
  `description` varchar(90) NOT NULL,
  `display` text NOT NULL,
  `keep` tinyint(4) NOT NULL,
  `collapse` tinyint(4) NOT NULL,
  `ordernum` smallint(6) NOT NULL,
  `ldsevent` tinyint(4) NOT NULL,
  `type` char(1) NOT NULL,
  PRIMARY KEY (`eventtypeID`),
  UNIQUE KEY `typetagdesc` (`type`,`tag`,`description`),
  KEY `ordernum` (`ordernum`)
) ENGINE=MyISAM AUTO_INCREMENT=104 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_trees;
CREATE TABLE `tng_trees` (
  `gedcom` varchar(20) NOT NULL,
  `treename` varchar(100) NOT NULL,
  `description` text NOT NULL,
  `owner` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `address` varchar(100) NOT NULL,
  `city` varchar(40) NOT NULL,
  `state` varchar(30) NOT NULL,
  `country` varchar(30) NOT NULL,
  `zip` varchar(20) NOT NULL,
  `phone` varchar(30) NOT NULL,
  `secret` tinyint(4) NOT NULL,
  `disallowgedcreate` tinyint(4) NOT NULL,
  `disallowpdf` tinyint(4) NOT NULL,
  `lastimportdate` datetime NOT NULL,
  `importfilename` varchar(100) NOT NULL,
  PRIMARY KEY (`gedcom`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_notelinks;
CREATE TABLE `tng_notelinks` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `persfamID` varchar(22) NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  `xnoteID` int(11) NOT NULL,
  `eventID` varchar(10) NOT NULL,
  `ordernum` float NOT NULL,
  `secret` tinyint(4) NOT NULL,
  PRIMARY KEY (`ID`),
  KEY `notelinks` (`gedcom`,`persfamID`,`eventID`)
) ENGINE=MyISAM AUTO_INCREMENT=6925 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_xnotes;
CREATE TABLE `tng_xnotes` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `noteID` varchar(22) NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  `note` text NOT NULL,
  PRIMARY KEY (`ID`),
  KEY `noteID` (`gedcom`,`noteID`),
  FULLTEXT KEY `note` (`note`)
) ENGINE=MyISAM AUTO_INCREMENT=3967 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_users;
CREATE TABLE `tng_users` (
  `userID` int(11) NOT NULL AUTO_INCREMENT,
  `description` varchar(50) NOT NULL,
  `username` varchar(100) NOT NULL,
  `password` varchar(128) NOT NULL,
  `password_type` varchar(10) NOT NULL,
  `gedcom` varchar(128) DEFAULT NULL,
  `mygedcom` varchar(20) NOT NULL,
  `personID` varchar(22) NOT NULL,
  `role` varchar(15) NOT NULL,
  `allow_edit` tinyint(4) NOT NULL,
  `allow_add` tinyint(4) NOT NULL,
  `tentative_edit` tinyint(4) NOT NULL,
  `allow_delete` tinyint(4) NOT NULL,
  `allow_lds` tinyint(4) NOT NULL,
  `allow_ged` tinyint(4) NOT NULL,
  `allow_pdf` tinyint(4) NOT NULL,
  `allow_living` tinyint(4) NOT NULL,
  `allow_private` tinyint(4) NOT NULL,
  `allow_private_notes` tinyint(4) NOT NULL,
  `allow_private_media` tinyint(4) NOT NULL,
  `allow_profile` tinyint(4) NOT NULL,
  `branch` varchar(20) DEFAULT NULL,
  `realname` varchar(50) DEFAULT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `address` varchar(100) DEFAULT NULL,
  `city` varchar(64) DEFAULT NULL,
  `state` varchar(64) DEFAULT NULL,
  `zip` varchar(10) DEFAULT NULL,
  `country` varchar(64) DEFAULT NULL,
  `website` varchar(128) DEFAULT NULL,
  `languageID` smallint(6) NOT NULL,
  `lastlogin` datetime NOT NULL,
  `disabled` tinyint(4) NOT NULL,
  `dt_registered` datetime NOT NULL,
  `dt_activated` datetime NOT NULL,
  `dt_consented` datetime NOT NULL,
  `no_email` tinyint(4) DEFAULT NULL,
  `notes` text,
  `reset_pwd_code` varchar(30) DEFAULT NULL,
  PRIMARY KEY (`userID`),
  UNIQUE KEY `username` (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_timelineevents;
CREATE TABLE `tng_timelineevents` (
  `tleventID` int(11) NOT NULL AUTO_INCREMENT,
  `evday` tinyint(4) NOT NULL,
  `evmonth` tinyint(4) NOT NULL,
  `evyear` varchar(10) NOT NULL,
  `endday` tinyint(4) NOT NULL,
  `endmonth` tinyint(4) NOT NULL,
  `endyear` varchar(10) NOT NULL,
  `evtitle` varchar(128) NOT NULL,
  `evdetail` text NOT NULL,
  PRIMARY KEY (`tleventID`),
  KEY `evyear` (`evyear`,`evmonth`,`evday`,`evdetail`(100)),
  KEY `evdetail` (`evdetail`(100))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_temp_events;
CREATE TABLE `tng_temp_events` (
  `tempID` int(11) NOT NULL AUTO_INCREMENT,
  `type` char(1) NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  `personID` varchar(22) NOT NULL,
  `familyID` varchar(22) NOT NULL,
  `eventID` varchar(10) NOT NULL,
  `eventdate` varchar(50) NOT NULL,
  `eventplace` text NOT NULL,
  `info` text NOT NULL,
  `note` text NOT NULL,
  `user` varchar(20) NOT NULL,
  `postdate` datetime NOT NULL,
  PRIMARY KEY (`tempID`),
  KEY `gedtype` (`gedcom`,`type`),
  KEY `user` (`user`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_templates;
CREATE TABLE `tng_templates` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `template` varchar(64) NOT NULL,
  `ordernum` int(11) NOT NULL,
  `keyname` varchar(64) NOT NULL,
  `language` varchar(64) NOT NULL,
  `value` text NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `template` (`template`,`keyname`,`language`),
  KEY `var_order` (`template`,`ordernum`)
) ENGINE=MyISAM AUTO_INCREMENT=568 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_media;
CREATE TABLE `tng_media` (
  `mediaID` int(11) NOT NULL AUTO_INCREMENT,
  `mediatypeID` varchar(20) NOT NULL,
  `mediakey` varchar(255) NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  `form` varchar(10) NOT NULL,
  `path` varchar(255) DEFAULT NULL,
  `description` text,
  `datetaken` varchar(50) DEFAULT NULL,
  `placetaken` text,
  `notes` text,
  `owner` text,
  `thumbpath` varchar(255) DEFAULT NULL,
  `alwayson` tinyint(4) DEFAULT NULL,
  `map` text,
  `abspath` tinyint(4) DEFAULT NULL,
  `status` varchar(40) DEFAULT NULL,
  `showmap` smallint(6) DEFAULT NULL,
  `cemeteryID` int(11) DEFAULT NULL,
  `plot` text,
  `linktocem` tinyint(4) DEFAULT NULL,
  `longitude` varchar(22) DEFAULT NULL,
  `latitude` varchar(22) DEFAULT NULL,
  `zoom` tinyint(4) DEFAULT NULL,
  `width` smallint(6) DEFAULT NULL,
  `height` smallint(6) DEFAULT NULL,
  `bodytext` text,
  `usenl` tinyint(4) DEFAULT NULL,
  `newwindow` tinyint(4) DEFAULT NULL,
  `usecollfolder` tinyint(4) DEFAULT NULL,
  `private` tinyint(4) NOT NULL,
  `changedate` datetime NOT NULL,
  `changedby` varchar(100) 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=MyISAM AUTO_INCREMENT=2964 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_medialinks;
CREATE TABLE `tng_medialinks` (
  `medialinkID` int(11) NOT NULL AUTO_INCREMENT,
  `gedcom` varchar(20) NOT NULL,
  `linktype` char(1) NOT NULL,
  `personID` varchar(248) NOT NULL,
  `eventID` varchar(10) NOT NULL,
  `mediaID` int(11) NOT NULL,
  `altdescription` text NOT NULL,
  `altnotes` text NOT NULL,
  `ordernum` float NOT NULL,
  `dontshow` tinyint(4) NOT NULL,
  `defphoto` varchar(1) NOT NULL,
  `cleft` smallint(6) NOT NULL,
  `ctop` smallint(6) NOT NULL,
  `cwidth` smallint(6) NOT NULL,
  `cheight` smallint(6) NOT NULL,
  PRIMARY KEY (`medialinkID`),
  UNIQUE KEY `mediaID` (`gedcom`,`personID`(22),`mediaID`,`eventID`),
  KEY `personID` (`gedcom`,`personID`(22),`ordernum`)
) ENGINE=MyISAM AUTO_INCREMENT=3709 DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_mediatypes;
CREATE TABLE `tng_mediatypes` (
  `mediatypeID` varchar(20) NOT NULL,
  `display` varchar(40) NOT NULL,
  `path` varchar(127) NOT NULL,
  `liketype` varchar(20) NOT NULL,
  `icon` varchar(50) NOT NULL,
  `thumb` varchar(50) NOT NULL,
  `exportas` varchar(20) NOT NULL,
  `disabled` tinyint(4) NOT NULL,
  `ordernum` tinyint(4) NOT NULL,
  `localpath` varchar(250) NOT NULL,
  `whatsnew` smallint(6) NOT NULL,
  `statistics` smallint(6) NOT NULL,
  `menus` smallint(6) NOT NULL,
  PRIMARY KEY (`mediatypeID`),
  KEY `ordernum` (`ordernum`,`display`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_mostwanted;
CREATE TABLE `tng_mostwanted` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `ordernum` float NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  `mwtype` varchar(10) NOT NULL,
  `title` varchar(128) NOT NULL,
  `description` text NOT NULL,
  `personID` varchar(22) NOT NULL,
  `mediaID` int(11) NOT NULL,
  PRIMARY KEY (`ID`),
  KEY `mwtype` (`mwtype`,`ordernum`,`title`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_dna_groups;
CREATE TABLE `tng_dna_groups` (
  `dna_group` varchar(20) NOT NULL,
  `test_type` varchar(40) NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  `description` varchar(128) NOT NULL,
  `action` tinyint(4) NOT NULL,
  PRIMARY KEY (`dna_group`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_dna_links;
CREATE TABLE `tng_dna_links` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `testID` int(11) NOT NULL,
  `personID` varchar(22) NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  `dna_group` varchar(128) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS tng_dna_tests;
CREATE TABLE `tng_dna_tests` (
  `testID` int(11) NOT NULL AUTO_INCREMENT,
  `test_type` varchar(40) NOT NULL,
  `test_number` varchar(50) NOT NULL,
  `notes` text NOT NULL,
  `vendor` varchar(100) NOT NULL,
  `test_date` date NOT NULL,
  `match_date` date NOT NULL,
  `personID` varchar(22) NOT NULL,
  `gedcom` varchar(20) NOT NULL,
  `person_name` varchar(100) NOT NULL,
  `urls` text NOT NULL,
  `mtdna_haplogroup` varchar(40) NOT NULL,
  `ydna_haplogroup` varchar(30) NOT NULL,
  `significant_snp` varchar(255) NOT NULL,
  `terminal_snp` varchar(80) NOT NULL,
  `markers` varchar(40) NOT NULL,
  `y_results` varchar(512) NOT NULL,
  `hvr1_results` varchar(100) NOT NULL,
  `hvr2_results` varchar(100) NOT NULL,
  `mtdna_confirmed` varchar(2) NOT NULL,
  `ydna_confirmed` varchar(2) NOT NULL,
  `markeropt` varchar(2) NOT NULL,
  `notesopt` varchar(2) NOT NULL,
  `linksopt` varchar(2) NOT NULL,
  `surnamesopt` tinyint(4) NOT NULL,
  `private_dna` varchar(2) NOT NULL,
  `private_test` varchar(2) NOT NULL,
  `dna_group` varchar(128) NOT NULL,
  `dna_group_desc` varchar(128) NOT NULL,
  `surnames` text NOT NULL,
  `MD_ancestorID` varchar(20) NOT NULL,
  `MRC_ancestorID` varchar(20) NOT NULL,
  `admin_notes` text NOT NULL,
  `medialinks` text NOT NULL,
  `ref_seq` text NOT NULL,
  `xtra_mut` text NOT NULL,
  `coding_reg` text NOT NULL,
  `GEDmatchID` varchar(30) NOT NULL,
  `relationship_range` varchar(80) NOT NULL,
  `suggested_relationship` varchar(80) NOT NULL,
  `actual_relationship` varchar(40) NOT NULL,
  `related_side` varchar(120) NOT NULL,
  `shared_cMs` varchar(10) NOT NULL,
  `shared_segments` varchar(10) NOT NULL,
  `chromosome` varchar(4) NOT NULL,
  `segment_start` varchar(40) NOT NULL,
  `segment_end` varchar(40) NOT NULL,
  `centiMorgans` varchar(40) NOT NULL,
  `matching_SNPs` varchar(10) NOT NULL,
  `x_match` varchar(2) NOT NULL,
  PRIMARY KEY (`testID`),
  KEY `test_date` (`test_date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
