summaryrefslogtreecommitdiffstats
path: root/schema/aur-schema.sql
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-04-04 00:01:44 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-04-05 12:21:35 +0200
commitb7941073acec76e5b4f89648aca1413c15eb067f (patch)
tree753a2484af94f5137825b8e49dc36885fae08eef /schema/aur-schema.sql
parent856298755246b3841f102b67ac123bca0f12a7fd (diff)
downloadaur-b7941073acec76e5b4f89648aca1413c15eb067f.tar.gz
aur-b7941073acec76e5b4f89648aca1413c15eb067f.tar.xz
Add provisional support for package bases
This adds a PackageBases table to the database schema and moves the following fields from the Packages table to PackageBases: * CategoryID * NumVotes * OutOfDateTS * SubmittedTS * ModifiedTS * SubmitterUID * MaintainerUID It also fixes all database accesses to comply with the new layout. Having a separate PackageBases table is the first step to split package support. By now, we create one PackageBases entry per package (where the package base has the same name as the corresponding package). When adding full support for split packages later, the package base name will be derived from the pkgbase variable and a single package base will be shared amongst all packages built from one source package. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'schema/aur-schema.sql')
-rw-r--r--schema/aur-schema.sql32
1 files changed, 22 insertions, 10 deletions
diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql
index 932c1d38..a885b7a3 100644
--- a/schema/aur-schema.sql
+++ b/schema/aur-schema.sql
@@ -92,16 +92,12 @@ INSERT INTO PackageCategories (Category) VALUES ('xfce');
INSERT INTO PackageCategories (Category) VALUES ('fonts');
--- Information about the actual packages
+-- Information on package bases
--
-CREATE TABLE Packages (
+CREATE TABLE PackageBases (
ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
Name VARCHAR(64) NOT NULL,
- Version VARCHAR(32) NOT NULL DEFAULT '',
CategoryID TINYINT UNSIGNED NOT NULL DEFAULT 1,
- Description VARCHAR(255) NOT NULL DEFAULT "An Arch Package",
- URL VARCHAR(255) NOT NULL DEFAULT "https://www.archlinux.org",
- License VARCHAR(40) NOT NULL DEFAULT '',
NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0,
OutOfDateTS BIGINT UNSIGNED NULL DEFAULT NULL,
SubmittedTS BIGINT UNSIGNED NOT NULL,
@@ -121,6 +117,22 @@ CREATE TABLE Packages (
) ENGINE = InnoDB;
+-- Information about the actual packages
+--
+CREATE TABLE Packages (
+ ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ PackageBaseID INTEGER UNSIGNED NOT NULL,
+ Name VARCHAR(64) NOT NULL,
+ Version VARCHAR(32) NOT NULL DEFAULT '',
+ Description VARCHAR(255) NOT NULL DEFAULT "An Arch Package",
+ URL VARCHAR(255) NOT NULL DEFAULT "https://www.archlinux.org",
+ License VARCHAR(40) NOT NULL DEFAULT '',
+ PRIMARY KEY (ID),
+ UNIQUE (Name),
+ FOREIGN KEY (PackageBaseID) REFERENCES PackageBases(ID) ON DELETE CASCADE
+) ENGINE = InnoDB;
+
+
-- Track which dependencies a package has
--
CREATE TABLE PackageDepends (
@@ -147,13 +159,13 @@ CREATE TABLE PackageSources (
--
CREATE TABLE PackageVotes (
UsersID INTEGER UNSIGNED NOT NULL,
- PackageID INTEGER UNSIGNED NOT NULL,
+ PackageBaseID INTEGER UNSIGNED NOT NULL,
INDEX (UsersID),
- INDEX (PackageID),
+ INDEX (PackageBaseID),
FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE,
- FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE
+ FOREIGN KEY (PackageBaseID) REFERENCES PackageBases(ID) ON DELETE CASCADE
) ENGINE = InnoDB;
-CREATE UNIQUE INDEX VoteUsersIDPackageID ON PackageVotes (UsersID, PackageID);
+CREATE UNIQUE INDEX VoteUsersIDPackageID ON PackageVotes (UsersID, PackageBaseID);
-- Record comments for packages
--