[2/3] Explicitly initialize PackageBases.FlaggerComment

Message ID 20170425070022.7244-2-lfleischer@archlinux.org
State Accepted, archived
Headers show
Series
  • [1/3] t1300: Factor out package dumping
Related show

Commit Message

Lukas Fleischer April 25, 2017, 7 a.m. UTC
Since commit 09cb61a (schema: Remove invalid default values for TEXT
columns, 2017-04-15), the PackageBases.FlaggerComment field no longer
has a default value. Initialize this field explicitly whenever a new row
is added to the PackageBases table.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
---
 aurweb/git/serve.py      |  5 +++--
 aurweb/git/update.py     |  5 +++--
 test/t1300-git-update.sh | 14 +++++++-------
 test/t2100-mkpkglists.sh |  8 ++++----
 test/t2300-pkgmaint.sh   |  8 ++++----
 test/t2500-notify.sh     |  8 ++++----
 6 files changed, 25 insertions(+), 23 deletions(-)

Patch

diff --git a/aurweb/git/serve.py b/aurweb/git/serve.py
index 44cce75..3eef26a 100755
--- a/aurweb/git/serve.py
+++ b/aurweb/git/serve.py
@@ -65,8 +65,9 @@  def create_pkgbase(pkgbase, user):
 
     now = int(time.time())
     cur = conn.execute("INSERT INTO PackageBases (Name, SubmittedTS, " +
-                       "ModifiedTS, SubmitterUID, MaintainerUID) VALUES " +
-                       "(?, ?, ?, ?, ?)", [pkgbase, now, now, userid, userid])
+                       "ModifiedTS, SubmitterUID, MaintainerUID, " +
+                       "FlaggerComment) VALUES (?, ?, ?, ?, ?, '')",
+                       [pkgbase, now, now, userid, userid])
     pkgbase_id = cur.lastrowid
 
     cur = conn.execute("INSERT INTO PackageNotifications " +
diff --git a/aurweb/git/update.py b/aurweb/git/update.py
index 09a57ef..c9a98d0 100755
--- a/aurweb/git/update.py
+++ b/aurweb/git/update.py
@@ -61,8 +61,9 @@  def create_pkgbase(conn, pkgbase, user):
 
     now = int(time.time())
     cur = conn.execute("INSERT INTO PackageBases (Name, SubmittedTS, " +
-                       "ModifiedTS, SubmitterUID, MaintainerUID) VALUES " +
-                       "(?, ?, ?, ?, ?)", [pkgbase, now, now, userid, userid])
+                       "ModifiedTS, SubmitterUID, MaintainerUID, " +
+                       "FlaggerComment) VALUES (?, ?, ?, ?, ?, '')",
+                       [pkgbase, now, now, userid, userid])
     pkgbase_id = cur.lastrowid
 
     cur = conn.execute("INSERT INTO PackageNotifications " +
diff --git a/test/t1300-git-update.sh b/test/t1300-git-update.sh
index dbe6029..f16e2ad 100755
--- a/test/t1300-git-update.sh
+++ b/test/t1300-git-update.sh
@@ -21,7 +21,7 @@  test_expect_success 'Test update hook on a fresh repository.' '
 	1|1|foobar|1-1|aurweb test package.|https://aur.archlinux.org/
 	1|GPL
 	1|1
-	1|1|python-pygit2||
+	1|1|python-pygit2|||
 	1|1
 	EOF
 	dump_package_info >actual &&
@@ -42,8 +42,8 @@  test_expect_success 'Test update hook on another fresh repository.' '
 	2|MIT
 	1|1
 	2|2
-	1|1|python-pygit2||
-	2|1|python-pygit2||
+	1|1|python-pygit2|||
+	2|1|python-pygit2|||
 	1|1
 	2|1
 	EOF
@@ -63,8 +63,8 @@  test_expect_success 'Test update hook on an updated repository.' '
 	2|MIT
 	2|2
 	3|1
-	2|1|python-pygit2||
-	3|1|python-pygit2||
+	2|1|python-pygit2|||
+	3|1|python-pygit2|||
 	1|1
 	2|1
 	EOF
@@ -82,8 +82,8 @@  test_expect_success 'Test restore mode.' '
 	2|MIT
 	2|2
 	3|1
-	2|1|python-pygit2||
-	3|1|python-pygit2||
+	2|1|python-pygit2|||
+	3|1|python-pygit2|||
 	1|1
 	2|1
 	EOF
diff --git a/test/t2100-mkpkglists.sh b/test/t2100-mkpkglists.sh
index a84a1b6..1e2edc3 100755
--- a/test/t2100-mkpkglists.sh
+++ b/test/t2100-mkpkglists.sh
@@ -14,10 +14,10 @@  test_expect_success 'Test package list generation with no packages.' '
 
 test_expect_success 'Test package list generation.' '
 	cat <<-EOD | sqlite3 aur.db &&
-	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS) VALUES (1, "foobar", 1, 0, 0);
-	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS) VALUES (2, "foobar2", 2, 0, 0);
-	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS) VALUES (3, "foobar3", NULL, 0, 0);
-	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS) VALUES (4, "foobar4", 1, 0, 0);
+	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS, FlaggerComment) VALUES (1, "foobar", 1, 0, 0, "");
+	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS, FlaggerComment) VALUES (2, "foobar2", 2, 0, 0, "");
+	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS, FlaggerComment) VALUES (3, "foobar3", NULL, 0, 0, "");
+	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS, FlaggerComment) VALUES (4, "foobar4", 1, 0, 0, "");
 	INSERT INTO Packages (ID, PackageBaseID, Name) VALUES (1, 1, "pkg1");
 	INSERT INTO Packages (ID, PackageBaseID, Name) VALUES (2, 1, "pkg2");
 	INSERT INTO Packages (ID, PackageBaseID, Name) VALUES (3, 1, "pkg3");
diff --git a/test/t2300-pkgmaint.sh b/test/t2300-pkgmaint.sh
index 5c55aaf..478df52 100755
--- a/test/t2300-pkgmaint.sh
+++ b/test/t2300-pkgmaint.sh
@@ -8,10 +8,10 @@  test_expect_success 'Test package base cleanup script.' '
 	now=$(date -d now +%s) &&
 	threedaysago=$(date -d "3 days ago" +%s) &&
 	cat <<-EOD | sqlite3 aur.db &&
-	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS) VALUES (1, "foobar", 1, $now, 0);
-	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS) VALUES (2, "foobar2", 2, $threedaysago, 0);
-	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS) VALUES (3, "foobar3", NULL, $now, 0);
-	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS) VALUES (4, "foobar4", NULL, $threedaysago, 0);
+	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS, FlaggerComment) VALUES (1, "foobar", 1, $now, 0, "");
+	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS, FlaggerComment) VALUES (2, "foobar2", 2, $threedaysago, 0, "");
+	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS, FlaggerComment) VALUES (3, "foobar3", NULL, $now, 0, "");
+	INSERT INTO PackageBases (ID, Name, PackagerUID, SubmittedTS, ModifiedTS, FlaggerComment) VALUES (4, "foobar4", NULL, $threedaysago, 0, "");
 	EOD
 	"$PKGMAINT" &&
 	cat <<-EOD >expected &&
diff --git a/test/t2500-notify.sh b/test/t2500-notify.sh
index 1b20945..3997682 100755
--- a/test/t2500-notify.sh
+++ b/test/t2500-notify.sh
@@ -6,10 +6,10 @@  test_description='notify tests'
 
 test_expect_success 'Test out-of-date notifications.' '
 	cat <<-EOD | sqlite3 aur.db &&
-	INSERT INTO PackageBases (ID, Name, MaintainerUID, SubmittedTS, ModifiedTS) VALUES (1, "foobar", 1, 0, 0);
-	INSERT INTO PackageBases (ID, Name, MaintainerUID, SubmittedTS, ModifiedTS) VALUES (2, "foobar2", 2, 0, 0);
-	INSERT INTO PackageBases (ID, Name, MaintainerUID, SubmittedTS, ModifiedTS) VALUES (3, "foobar3", NULL, 0, 0);
-	INSERT INTO PackageBases (ID, Name, MaintainerUID, SubmittedTS, ModifiedTS) VALUES (4, "foobar4", 1, 0, 0);
+	INSERT INTO PackageBases (ID, Name, MaintainerUID, SubmittedTS, ModifiedTS, FlaggerComment) VALUES (1, "foobar", 1, 0, 0, "");
+	INSERT INTO PackageBases (ID, Name, MaintainerUID, SubmittedTS, ModifiedTS, FlaggerComment) VALUES (2, "foobar2", 2, 0, 0, "");
+	INSERT INTO PackageBases (ID, Name, MaintainerUID, SubmittedTS, ModifiedTS, FlaggerComment) VALUES (3, "foobar3", NULL, 0, 0, "");
+	INSERT INTO PackageBases (ID, Name, MaintainerUID, SubmittedTS, ModifiedTS, FlaggerComment) VALUES (4, "foobar4", 1, 0, 0, "");
 	INSERT INTO PackageComaintainers (PackageBaseID, UsersID, Priority) VALUES (1, 2, 1);
 	INSERT INTO PackageComaintainers (PackageBaseID, UsersID, Priority) VALUES (1, 4, 2);
 	INSERT INTO PackageComaintainers (PackageBaseID, UsersID, Priority) VALUES (2, 3, 1);