CREATE TABLE IF NOT EXISTS `Ebooks` (
  `EbookId` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `Identifier` varchar(511) NOT NULL,
  `Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `Updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `WwwFilesystemPath` varchar(511) NULL,
  `RepoFilesystemPath` varchar(511) NULL,
  `KindleCoverUrl` varchar(511) NULL,
  `EpubUrl` varchar(511) NULL,
  `AdvancedEpubUrl` varchar(511) NULL,
  `KepubUrl` varchar(511) NULL,
  `Azw3Url` varchar(511) NULL,
  `DistCoverUrl` varchar(511) NULL,
  `Title` varchar(255) NOT NULL,
  `FullTitle` varchar(255) NULL,
  `AlternateTitle` varchar(255) NULL,
  `Description` text NULL,
  `LongDescription` text NULL,
  `Language` varchar(10) NULL,
  `WordCount` int(10) unsigned NULL,
  `ReadingEase` float NULL,
  `GitHubUrl` varchar(255) NULL,
  `WikipediaUrl` varchar(255) NULL,
  `EbookCreated` datetime NULL,
  `EbookUpdated` datetime NULL,
  `TextSinglePageByteCount` bigint unsigned NULL,
  `IndexableText` text NULL,
  `IndexableAuthors` text NOT NULL,
  `IndexableCollections` text NULL,
  `DownloadsPast30Days` int(10) unsigned NOT NULL DEFAULT 0,
  `DownloadsTotal` int(10) unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (`EbookId`),
  UNIQUE KEY `index1` (`Identifier`),
  KEY `index2` (`EbookCreated`),
  FULLTEXT `idxSearch` (`IndexableText`),
  FULLTEXT `idxSearchTitle` (`Title`),
  FULLTEXT `idxSearchAuthors` (`IndexableAuthors`),
  FULLTEXT `idxSearchCollections` (`IndexableCollections`),
  FULLTEXT `idxSearchCombined` (`IndexableText`, `Title`, `IndexableAuthors`, `IndexableCollections`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
