mirror of
https://github.com/standardebooks/web.git
synced 2025-07-22 15:24:46 -04:00
Record and summarize Ebook downloads in the DB (#498)
This commit is contained in:
parent
61b8ca27b1
commit
475c437126
12 changed files with 289 additions and 4 deletions
9
config/sql/se/EbookDownloadSummaries.sql
Normal file
9
config/sql/se/EbookDownloadSummaries.sql
Normal file
|
@ -0,0 +1,9 @@
|
|||
CREATE TABLE IF NOT EXISTS `EbookDownloadSummaries` (
|
||||
`EbookId` int(10) unsigned NOT NULL,
|
||||
`Date` date NOT NULL,
|
||||
`DownloadCount` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`BotDownloadCount` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
UNIQUE INDEX `idxUnique` (`EbookId`, `Date`),
|
||||
INDEX `index1` (Date, EbookId, DownloadCount),
|
||||
INDEX `index2` (EbookId, DownloadCount)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
7
config/sql/se/EbookDownloads.sql
Normal file
7
config/sql/se/EbookDownloads.sql
Normal file
|
@ -0,0 +1,7 @@
|
|||
CREATE TABLE IF NOT EXISTS `EbookDownloads` (
|
||||
`EbookId` int(10) unsigned NOT NULL,
|
||||
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`IpAddress` inet6 NULL,
|
||||
`UserAgent` mediumtext NULL,
|
||||
INDEX `idxCreated` (`Created`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
@ -27,6 +27,8 @@ CREATE TABLE IF NOT EXISTS `Ebooks` (
|
|||
`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`),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue