summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Weiman <mark.weiman@markzz.com>2017-05-02 15:58:07 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2017-05-02 16:29:40 +0200
commit0c6a415cb36ef8f245c787dfe68d107066f9dfbd (patch)
treeeb1a7a0c51d2ea17267d4f67d2fb2e34b117f008
parenta8ac2004d3f25877d9e7b4fa58f10009c39f8acf (diff)
downloadaur-0c6a415cb36ef8f245c787dfe68d107066f9dfbd.tar.gz
aur-0c6a415cb36ef8f245c787dfe68d107066f9dfbd.tar.xz
gendummydata.py: Fix NOT NULL constraint problems
PackageBases.FlaggerComment and PackageComments.RenderedComment cannot be NULL and would cause problems in the output file for sqlite users. This patch adds empty strings ("") as values for these fields. Signed-off-by: Mark Weiman <mark.weiman@markzz.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rwxr-xr-xschema/gendummydata.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/schema/gendummydata.py b/schema/gendummydata.py
index 373f82ea..5ed63327 100755
--- a/schema/gendummydata.py
+++ b/schema/gendummydata.py
@@ -205,8 +205,8 @@ for p in list(seen_pkgs.keys()):
uuid = genUID() # the submitter/user
- s = ("INSERT INTO PackageBases (ID, Name, SubmittedTS, ModifiedTS, "
- "SubmitterUID, MaintainerUID, PackagerUID) VALUES (%d, '%s', %d, %d, %d, %s, %s);\n")
+ s = ("INSERT INTO PackageBases (ID, Name, FlaggerComment, SubmittedTS, ModifiedTS, "
+ "SubmitterUID, MaintainerUID, PackagerUID) VALUES (%d, '%s', '', %d, %d, %d, %s, %s);\n")
s = s % (seen_pkgs[p], p, NOW, NOW, uuid, muid, puid)
out.write(s)
@@ -223,7 +223,7 @@ for p in list(seen_pkgs.keys()):
for i in range(0, num_comments):
now = NOW + random.randrange(400, 86400*3)
s = ("INSERT INTO PackageComments (PackageBaseID, UsersID,"
- " Comments, CommentTS) VALUES (%d, %d, '%s', %d);\n")
+ " Comments, RenderedComment, CommentTS) VALUES (%d, %d, '%s', '', %d);\n")
s = s % (seen_pkgs[p], genUID(), genFortune(), now)
out.write(s)