Commit graph

82 commits

Author SHA1 Message Date
Mike Colagrosso
af956b2714
Replace EbookUrl with EbookId in Artworks (#482)
* Replace `EbookUrl` with `EbookId` in `Artworks`

* Add a `FullUrl` member to `Ebook`

Add documentation about when to use it versus Url.

The full URL is also being used as an ID in RSS feeds, so use `FullUrl` there.

* Store an `EbookId` in `Artworks`
2025-03-10 14:33:20 -05:00
Mike Colagrosso
a3ce3f1ec1 Make IndexableText optional
Placeholders do not have FullTitle, AlternateTitle, Tags, LocSubjects,
or TocEntries.
2025-02-13 13:48:39 -06:00
Mike Colagrosso
61bbf8f071 Add idxSearchCombined to match multiple fields
The data in these fields are separate:

* `IndexableText`
* `Title`
* `IndexableAuthors`
* `IndexableCollections`

There are also on indices on each of these fields so that they can have
separate weight in the relevance scoring.
2025-02-13 13:48:39 -06:00
Mike Colagrosso
1a71913794 Add a Relevance sort order and improve search
Here's what's in `IndexableText` right now:

1. Title
2. Collections
3. Authors
4. Tags
5. LocSubjects
6. TocEntries

Here is the proposed new ranking:

```
10 * Title +
8 * Authors +
3 * Collections +
IndexableText
```

New indices for existing DBs:

```
ALTER TABLE `Ebooks` ADD COLUMN `IndexableAuthors` text NOT NULL;
ALTER TABLE `Ebooks` ADD COLUMN `IndexableCollections` text NULL;
ALTER TABLE `Ebooks` ADD FULLTEXT `indexSearchTitle` (`Title`);
ALTER TABLE `Ebooks` ADD FULLTEXT `idxSearchAuthors` (`IndexableAuthors`);
ALTER TABLE `Ebooks` ADD FULLTEXT `idxSearchCollections` (`IndexableCollections`);
```
2025-02-13 13:48:39 -06:00
Alex Cabal
6378d687d8 Add 'awaiting review' and 'reviewed' project statuses that update from GitHub; allow project owners to update their project statuses 2025-01-27 15:52:21 -06:00
Mike Colagrosso
dad5df0059 Add index on EbookId
There are several queries that join the `Projects` and `Ebooks` tables.
An index speeds up those joins.
2025-01-02 09:57:45 -06:00
Mike Colagrosso
5c8315e6ff Add new indices for deleting unused records 2024-12-31 22:31:00 -06:00
Alex Cabal
4596aeb007 Allow projects to auto-assign managers and reviewers 2024-12-18 20:57:21 -06:00
Alex Cabal
7a3c7ad503 Allow VCS URLs to be null in projects 2024-12-16 21:48:01 -06:00
Alex Cabal
051e286a6d Continue fleshing out project management system 2024-12-16 15:01:22 -06:00
Alex Cabal
5782d6ca7d Further refine projects system 2024-12-15 23:39:23 -06:00
Alex Cabal
2449de6f6c Also check discussion threads for freshness when marking projects as stalled 2024-12-15 21:59:01 -06:00
Alex Cabal
9b9d93bc52 Automatically update in progress projects to stalled 2024-12-14 23:54:11 -06:00
Alex Cabal
c7a4e34e31 Add projects index page, and more detail on placeholder pages 2024-12-14 21:12:00 -06:00
Alex Cabal
adfe07aad9 Add beginning of a project management system to placeholders 2024-12-14 19:13:03 -06:00
Alex Cabal
e56de4b19d Switch from EbookPlaceholder.Status to EbookPlaceholder.IsInProgress, and some type tweaks 2024-12-14 13:39:28 -06:00
Alex Cabal
1a742baa51 Add CanEditEbooks benefit and clean up some PHPStan errors 2024-12-14 11:50:16 -06:00
Alex Cabal
23b5c8ef31 Allow admin to view collection metadata 2024-12-14 11:32:02 -06:00
Alex Cabal
cb1cfc8c21 Add accounting bit to Collections table 2024-12-14 00:02:21 -06:00
Mike Colagrosso
1ab95df084 Add placeholders for ebooks 2024-12-13 11:46:36 -06:00
Alex Cabal
9a2b095b70 Allow adjustment of Patrons Circle cost 2024-12-05 14:32:46 -06:00
Alex Cabal
8ad3291a35 Add admin form to view and edit users 2024-11-23 14:30:11 -06:00
Alex Cabal
d6a2bdcbc8 Make MARC roles an enum and restructure how contributors are fetched from the DB to reduce queries 2024-11-11 12:01:53 -06:00
Alex Cabal
b3a9d86828 Fix SQL definition 2024-11-11 11:21:21 -06:00
Alex Cabal
acb30b897c Add PropertyFromHttp trait and update codebase to use new pattern 2024-11-10 22:23:43 -06:00
Mike Colagrosso
312e2105ec Change Created datetime to timestamp to match 88c3049 2024-11-04 13:16:56 -06:00
Mike Colagrosso
c3c4cbddca Adopt IF NOT EXISTS approach from 82e43cb 2024-11-04 13:16:56 -06:00
Mike Colagrosso
95a1edc8b7 Bump TocEntries.SortOrder from tinyint to smallint
Ebooks can have more than 255 TocEntries. (572 is the current highest.)
2024-11-04 13:16:56 -06:00
Mike Colagrosso
c8e6524ef2 Remove primary key TocEntryId
Add a SortOrder column to order the TocEntries instead.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
2eb7fef027 Remove primary key GitCommitId
The table already has a Created column, and that's the column we use to sort on.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
3f3cf702b2 Remove primary key ContributorId
`Ebook` to `Contributor` is one to many, and we don't query by ContributorId.
The table already has a SortOrder column, and we use that to order the queries.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
1076c9a77d Remove primary key EbookSourceId
There is a one to many relationship between `Ebook` and `EbookSource`, and we
don't query by `EbookSourceId`. We add a `SortOrder` column to keep the sources
in the same order as specified in `content.opf`.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
4e8ba5ddaa Remove primary key EbookTagId
Add a SortOrder column so that tags are presented in the same order as listed in content.opf.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
b4b6fde778 Remove primary key EbookLocSubjectId
Add a SortOrder column to keep the LocSubjects in the same order as given in content.opf.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
cada95383f Remove primary key CollectionEbookId
Add a SortOrder to preserve the order of the collections listed in content.opf for ebook.php, e.g., for To the Lighthouse:

№ 15 in the Modern Library’s 100 Best Novels set.
Part of the Encyclopædia Britannica’s Great Books of the Western World set.
№ 2 in the BBC’s 100 Greatest British Novels (2015) set.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
783a41a1ba Make Ebook Language NOT NULL 2024-11-04 13:16:56 -06:00
Mike Colagrosso
7d8cfd351e Ebook tags: Store UrlName so it can be queried 2024-11-04 13:16:56 -06:00
Mike Colagrosso
b792dec9e5 Make collection type (series, set) an enum 2024-11-04 13:16:56 -06:00
Mike Colagrosso
a9a0782946 Timestamps: Set DEFAULT and ON UPDATE values
Newer versions of MariaDB, such as this one included with Ubuntu 24.04:

    Server version: 10.11.8-MariaDB-0ubuntu0.24.04.1 Ubuntu 24.04

change the default behavior to not automatically set timestamp defaults and on update values:

    $ mysqld --verbose --help | grep explicit-defaults-for-timestamp
    explicit-defaults-for-timestamp                              TRUE

whereas my older machines allowed it:

    $ mysqld --verbose --help | grep explicit-defaults-for-timestamp
    explicit-defaults-for-timestamp                              FALSE

More background on the flag here:

    https://dev.mysql.com/doc/refman/8.4/en/timestamp-initialization.html
2024-11-04 13:16:56 -06:00
Mike Colagrosso
4abf6e29d2 Add an index for EbookCreated
This is the default sort on /ebooks, so it should have an index
2024-11-04 13:16:56 -06:00
Mike Colagrosso
402dae95ff Add a Type enum to Tags for artwork/ebook 2024-11-04 13:16:56 -06:00
Mike Colagrosso
a25660bc8b Split Collections into two tables 2024-11-04 13:16:56 -06:00
Mike Colagrosso
ac7db8d375 Add primary keys to LocSubjects and Tags tables
Missed these before, and in addition to being a good practice, they are needed to maintain insertion order of LocSubjects and Tags.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
79daa82bf4 Add primary keys to multiple tables
I missed these keys when creating the initial schema, and it's a useful practice.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
7350891cd5 Spell out EbookSourceType values 2024-11-04 13:16:56 -06:00
Mike Colagrosso
88b3ffd9ed Store EbookSourceType as a string/enum, not int 2024-11-04 13:16:56 -06:00
Mike Colagrosso
073f138c47 Initial Ebook DB schema 2024-11-04 13:16:56 -06:00
Alex Cabal
88c3049d7a Change some datetime columns to timestamp 2024-10-24 16:37:09 -05:00
Alex Cabal
82e43cb520 Add DB setup to readme 2024-10-23 11:09:16 -05:00
Alex Cabal
b6fbcaba26 Remove irrelevant user from SQL config 2024-10-22 22:47:56 -05:00