diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-04-04 00:01:44 +0200 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2014-04-05 12:21:35 +0200 |
commit | b7941073acec76e5b4f89648aca1413c15eb067f (patch) | |
tree | 753a2484af94f5137825b8e49dc36885fae08eef /schema/gendummydata.py | |
parent | 856298755246b3841f102b67ac123bca0f12a7fd (diff) | |
download | aur-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/gendummydata.py')
-rwxr-xr-x | schema/gendummydata.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/schema/gendummydata.py b/schema/gendummydata.py index 361d1f90..c2cb388c 100755 --- a/schema/gendummydata.py +++ b/schema/gendummydata.py @@ -199,12 +199,16 @@ for p in list(seen_pkgs.keys()): uuid = genUID() # the submitter/user - s = ("INSERT INTO Packages (ID, Name, Version, CategoryID," - " SubmittedTS, SubmitterUID, MaintainerUID) VALUES " - " (%d, '%s', '%s', %d, %d, %d, %s);\n") - s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid, muid) + s = ("INSERT INTO PackageBases (ID, Name, CategoryID, SubmittedTS, " + "SubmitterUID, MaintainerUID) VALUES (%d, '%s', %d, %d, %d, %s);\n") + s = s % (seen_pkgs[p], p, genCategory(), NOW, uuid, muid) + out.write(s) + s = ("INSERT INTO Packages (ID, PackageBaseID, Name, Version) VALUES " + "(%d, %d, '%s', '%s');\n") + s = s % (seen_pkgs[p], seen_pkgs[p], p, genVersion()) out.write(s) + count += 1 # create random comments for this package @@ -228,7 +232,7 @@ for u in user_keys: for v in range(num_votes): pkg = random.randrange(1, len(seen_pkgs) + 1) if pkg not in pkgvote: - s = ("INSERT INTO PackageVotes (UsersID, PackageID)" + s = ("INSERT INTO PackageVotes (UsersID, PackageBaseID)" " VALUES (%d, %d);\n") s = s % (seen_users[u], pkg) pkgvote[pkg] = 1 @@ -240,7 +244,7 @@ for u in user_keys: # Update statements for package votes # for p in list(track_votes.keys()): - s = "UPDATE Packages SET NumVotes = %d WHERE ID = %d;\n" + s = "UPDATE PackageBases SET NumVotes = %d WHERE ID = %d;\n" s = s % (track_votes[p], p) out.write(s) |