diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2011-02-27 18:19:03 +0100 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2011-02-27 19:46:30 +0100 |
commit | bc238965cbb191f8c677d941622d13c8c0472ab1 (patch) | |
tree | 935cf7f402eabbd4dc1fc876464704fa84263bc9 /support/schema/gendummydata.py | |
parent | 85c0db0ccd0dd3e57418c55ba3a843dbaa26fec2 (diff) |
Fix some minor bugs in "support/schema/gendummydata.py".
The dummy data generation script used to create wrong package IDs for
both "PackageVotes" and "PackageDepends" tables which led to errors when
reloading the test data (constraints failed). This is fixed by no longer
creating entries with zero ("0") package IDs.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'support/schema/gendummydata.py')
-rwxr-xr-x | support/schema/gendummydata.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/support/schema/gendummydata.py b/support/schema/gendummydata.py index 45812a9..090aabb 100755 --- a/support/schema/gendummydata.py +++ b/support/schema/gendummydata.py @@ -261,7 +261,7 @@ for u in user_keys: int(len(seen_pkgs)*VOTING[1])) pkgvote = {} for v in range(num_votes): - pkg = random.randrange(0, len(seen_pkgs)) + pkg = random.randrange(1, len(seen_pkgs) + 1) if not pkgvote.has_key(pkg): s = "INSERT INTO PackageVotes (UsersID, PackageID) VALUES (%d, %d);\n" % (seen_users[u], pkg) pkgvote[pkg] = 1 @@ -288,7 +288,7 @@ for p in seen_pkgs.keys(): this_deps = {} i = 0 while i != num_deps: - dep = random.randrange(0, len(seen_pkgs)) + dep = random.randrange(1, len(seen_pkgs) + 1) if not this_deps.has_key(dep): s = "INSERT INTO PackageDepends VALUES (%d, %d, NULL);\n" % (seen_pkgs[p], dep) out.write(s) |