summaryrefslogtreecommitdiffstats
path: root/UPGRADING
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-04-26 14:40:07 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-04-26 14:48:19 +0200
commit9553790cfc9a3bcb5c4bf2266565862082c26613 (patch)
treee3511cc1a1c23269867cabbdfeecc6b5db765a9c /UPGRADING
parent38eb8d2a3ab0b7f35618d151613211d45f6ec4d8 (diff)
downloadaur-9553790cfc9a3bcb5c4bf2266565862082c26613.tar.gz
aur-9553790cfc9a3bcb5c4bf2266565862082c26613.tar.xz
Support multiple licenses per package
Split out package licenses into two separate tables in order to support multiple licenses per package. The code on the package details page is adjusted accordingly. UPGRADING contains instructions on how to convert existing licenses in the database to the new layout. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'UPGRADING')
-rw-r--r--UPGRADING33
1 files changed, 33 insertions, 0 deletions
diff --git a/UPGRADING b/UPGRADING
index 814fea1a..357cd6c7 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -217,6 +217,39 @@ CREATE TABLE PackageGroups (
) ENGINE = InnoDB;
----
+18. Create tables to store package licenses:
+
+----
+CREATE TABLE Licenses (
+ ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ Name VARCHAR(64) NOT NULL,
+ PRIMARY KEY (ID),
+ UNIQUE (Name)
+) ENGINE = InnoDB;
+CREATE TABLE PackageLicenses (
+ PackageID INTEGER UNSIGNED NOT NULL,
+ LicenseID INTEGER UNSIGNED NOT NULL,
+ PRIMARY KEY (PackageID, LicenseID),
+ FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE,
+ FOREIGN KEY (LicenseID) REFERENCES Licenses(ID) ON DELETE CASCADE
+) ENGINE = InnoDB;
+----
+
+19. Convert existing licenses to the new storage format:
+
+----
+INSERT INTO Licenses (Name) SELECT DISTINCT License FROM Packages;
+INSERT INTO PackageLicenses (PackageID, LicenseID)
+ SELECT Packages.ID, Licenses.ID FROM Packages
+ INNER JOIN Licenses ON Licenses.Name = Packages.License;
+----
+
+20. Delete the license column from the Packages table:
+
+----
+ALTER TABLE Packages DROP COLUMN License;
+----
+
From 2.2.0 to 2.3.0
-------------------