aurweb/upgrading/4.6.0.txt
Lukas Fleischer a8ac2004d3 Add support for Terms of Service documents
This allows for adding Terms of Service documents to the database that
registered users need to accept before using the AUR. A revision field
can be used to indicate whether a document was updated. If it is
increased, all users are again asked to accept the new terms.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-30 16:47:13 +02:00

37 lines
1.1 KiB
Text

1. Add DepDesc column to PackageDepends and split dependency names:
---
ALTER TABLE PackageDepends ADD COLUMN DepDesc VARCHAR(255) NULL DEFAULT NULL;
UPDATE PackageDepends
SET DepDesc = SUBSTRING(DepName FROM POSITION(': ' IN DepName) + 2)
WHERE POSITION(': ' IN DepName) > 0;
UPDATE PackageDepends
SET DepName = SUBSTRING(DepName FROM 1 FOR POSITION(': ' IN DepName) - 1)
WHERE POSITION(': ' IN DepName) > 0;
---
2. Add RenderedComment column to PackageComments:
---
ALTER TABLE PackageComments ADD COLUMN RenderedComment TEXT NOT NULL;
---
3. Add Terms and AcceptedTerms tables:
---
CREATE TABLE Terms (
ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
Description VARCHAR(255) NOT NULL,
URL VARCHAR(8000) NOT NULL,
Revision INTEGER UNSIGNED NOT NULL DEFAULT 1,
PRIMARY KEY (ID)
) ENGINE = InnoDB;
CREATE TABLE AcceptedTerms (
UsersID INTEGER UNSIGNED NOT NULL,
TermsID INTEGER UNSIGNED NOT NULL,
Revision INTEGER UNSIGNED NOT NULL DEFAULT 0,
FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE,
FOREIGN KEY (TermsID) REFERENCES Terms(ID) ON DELETE CASCADE
) ENGINE = InnoDB;
---