Commit f4e2d143 authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

Explicitly initialize PackageBases.FlaggerComment

Since commit 09cb61ab

 (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's avatarLukas Fleischer <lfleischer@archlinux.org>
parent 90ab7c7b
......@@ -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 " +
......
......@@ -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 " +
......
......@@ -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
......
......@@ -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");
......
......@@ -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 &&
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment