Add DB setup to readme

This commit is contained in:
Alex Cabal 2024-10-23 11:09:16 -05:00
parent b6fbcaba26
commit 82e43cb520
20 changed files with 27 additions and 21 deletions

View file

@ -38,6 +38,11 @@ sudo ln -s /standardebooks.org/web/config/php/fpm/standardebooks.test.ini /etc/p
sudo ln -s /standardebooks.org/web/config/php/fpm/standardebooks.test.ini /etc/php/*/fpm/conf.d/
sudo ln -s /standardebooks.org/web/config/php/fpm/standardebooks.test.conf /etc/php/*/fpm/pool.d/
sudo systemctl restart "php*-fpm.service"
# Create and populate the SE database.
mariadb < /standardebooks.org/web/config/sql/se.sql
mariadb < /standardebooks.org/web/config/sql/users.sql
mariadb se < /standardebooks.org/web/config/sql/se/*.sql
```
If everything went well you should now be able to open your web browser and visit `https://standardebooks.test`. However, you wont see any ebooks if you visit `https://standardebooks.test/ebooks`. To install some ebooks, first you have to clone their source from GitHub, then deploy them to your local website using the `./scripts/deploy-ebook-to-www` script:

1
config/sql/se.sql Normal file
View file

@ -0,0 +1 @@
CREATE DATABASE IF NOT EXISTS `se` DEFAULT CHARACTER SET = 'utf8mb4' DEFAULT COLLATE 'utf8mb4_general_ci'

View file

@ -1,4 +1,4 @@
CREATE TABLE `ArtistAlternateNames` (
CREATE TABLE IF NOT EXISTS `ArtistAlternateNames` (
`ArtistId` int(10) unsigned NOT NULL,
`Name` varchar(255) NOT NULL,
`UrlName` varchar(255) NOT NULL,

View file

@ -1,4 +1,4 @@
CREATE TABLE `Artists` (
CREATE TABLE IF NOT EXISTS `Artists` (
`ArtistId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Name` varchar(255) NOT NULL,
`UrlName` varchar(255) NOT NULL,

View file

@ -1,4 +1,4 @@
CREATE TABLE `ArtworkTags` (
CREATE TABLE IF NOT EXISTS `ArtworkTags` (
`ArtworkId` int(10) unsigned NOT NULL,
`TagId` int(10) unsigned NOT NULL,
UNIQUE KEY `idxUnique` (`ArtworkId`,`TagId`)

View file

@ -1,4 +1,4 @@
CREATE TABLE `Artworks` (
CREATE TABLE IF NOT EXISTS `Artworks` (
`ArtworkId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ArtistId` int(10) unsigned NOT NULL,
`Name` varchar(255) NOT NULL,
@ -19,7 +19,7 @@ CREATE TABLE `Artworks` (
`EbookUrl` varchar(255) NULL,
`MimeType` enum('image/jpeg', 'image/png', 'image/bmp', 'image/tiff') NOT NULL,
`Exception` TEXT NULL DEFAULT NULL,
`Notes` TEXT NULL DEFAULT NULL
`Notes` TEXT NULL DEFAULT NULL,
PRIMARY KEY (`ArtworkId`),
KEY `index1` (`Status`),
KEY `index2` (`UrlName`),

View file

@ -1,4 +1,4 @@
CREATE TABLE `Benefits` (
CREATE TABLE IF NOT EXISTS `Benefits` (
`UserId` int(10) unsigned NOT NULL,
`CanAccessFeeds` tinyint(1) unsigned NOT NULL DEFAULT 0,
`CanVote` tinyint(1) unsigned NOT NULL DEFAULT 0,

View file

@ -1,4 +1,4 @@
CREATE TABLE `FeedUserAgents` (
CREATE TABLE IF NOT EXISTS `FeedUserAgents` (
`UserAgentId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`UserAgent` text NOT NULL,
`Created` datetime NOT NULL,

View file

@ -1,4 +1,4 @@
CREATE TABLE `Museums` (
CREATE TABLE IF NOT EXISTS `Museums` (
`MuseumId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Name` varchar(255) NOT NULL,
`Domain` varchar(255) NOT NULL,

View file

@ -1,4 +1,4 @@
CREATE TABLE `NewsletterSubscriptions` (
CREATE TABLE IF NOT EXISTS `NewsletterSubscriptions` (
`UserId` int(10) unsigned NOT NULL,
`IsConfirmed` tinyint(1) unsigned NOT NULL DEFAULT 0,
`IsSubscribedToNewsletter` tinyint(1) unsigned NOT NULL DEFAULT 1,

View file

@ -1,4 +1,4 @@
CREATE TABLE `Patrons` (
CREATE TABLE IF NOT EXISTS `Patrons` (
`UserId` int(10) unsigned NOT NULL,
`IsAnonymous` tinyint(1) unsigned NOT NULL DEFAULT 0,
`AlternateName` varchar(80) DEFAULT NULL,

View file

@ -1,4 +1,4 @@
CREATE TABLE `Payments` (
CREATE TABLE IF NOT EXISTS `Payments` (
`PaymentId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`UserId` int(10) unsigned DEFAULT NULL,
`Created` datetime NOT NULL,

View file

@ -1,4 +1,4 @@
CREATE TABLE `PendingPayments` (
CREATE TABLE IF NOT EXISTS `PendingPayments` (
`Created` datetime NOT NULL,
`Processor` enum('fractured_atlas') NOT NULL,
`TransactionId` varchar(80) NOT NULL,

View file

@ -1,4 +1,4 @@
CREATE TABLE `PollItems` (
CREATE TABLE IF NOT EXISTS `PollItems` (
`PollItemId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`PollId` int(10) unsigned NOT NULL,
`Name` varchar(255) NOT NULL,

View file

@ -1,4 +1,4 @@
CREATE TABLE `PollVotes` (
CREATE TABLE IF NOT EXISTS `PollVotes` (
`UserId` int(10) unsigned NOT NULL,
`PollItemId` int(10) unsigned NOT NULL,
`Created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,

View file

@ -1,4 +1,4 @@
CREATE TABLE `Polls` (
CREATE TABLE IF NOT EXISTS `Polls` (
`PollId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`Name` varchar(255) NOT NULL,

View file

@ -1,4 +1,4 @@
CREATE TABLE `Sessions` (
CREATE TABLE IF NOT EXISTS `Sessions` (
`UserId` int(10) unsigned NOT NULL,
`Created` datetime NOT NULL,
`SessionId` char(36) NOT NULL,

View file

@ -1,4 +1,4 @@
CREATE TABLE `Tags` (
CREATE TABLE IF NOT EXISTS `Tags` (
`TagId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Name` varchar(255) NOT NULL,
PRIMARY KEY (`TagId`),

View file

@ -1,4 +1,4 @@
CREATE TABLE `Users` (
CREATE TABLE IF NOT EXISTS `Users` (
`UserId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Email` varchar(80) DEFAULT NULL,
`Name` varchar(255) DEFAULT NULL,

View file

@ -1,6 +1,6 @@
create user 'se'@'localhost' identified via unix_socket;
create user 'www-data'@'localhost' identified via unix_socket;
create user 'se-vcs-bot'@'localhost' identified via unix_socket;
create user if not exists 'se'@'localhost' identified via unix_socket;
create user if not exists 'www-data'@'localhost' identified via unix_socket;
create user if not exists 'se-vcs-bot'@'localhost' identified via unix_socket;
grant select, insert, update, delete, execute, lock tables on se.* to 'se'@'localhost' identified via unix_socket;
grant select, insert, update, delete, execute on se.* to 'www-data'@'localhost' identified via unix_socket;