summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2019-03-24 07:25:38 +0100
committerHelmut Grohne <helmut@subdivi.de>2019-03-24 07:25:38 +0100
commita2eccde5e1e83f77bd015990279f75f8b3c7db4a (patch)
tree0f693e9527f02aa18a5b723709e4a5557733a490
parent594575d553cec98ff5d9f10d5543a26dd3ee2967 (diff)
downloadcrossqa-a2eccde5e1e83f77bd015990279f75f8b3c7db4a.tar.gz
table buildreqeusts should have an explicit id
We rely on the id being constant. However, sqlite does not guarantee that the implicit rowid stays constant across vacuum. Making the rowid explicit fixes that.
-rwxr-xr-xbuild.py4
-rw-r--r--schema.sql1
2 files changed, 3 insertions, 2 deletions
diff --git a/build.py b/build.py
index 6a40dd3..3ede7f1 100755
--- a/build.py
+++ b/build.py
@@ -46,7 +46,7 @@ def main():
db = sqlite3.connect("db", detect_types=sqlite3.PARSE_DECLTYPES)
with contextlib.closing(db.cursor()) as cur:
cur.execute("""
- SELECT d.source, d.version, d.architecture, r.rowid
+ SELECT d.source, d.version, d.architecture, r.id
FROM depstate AS d
JOIN buildrequests AS r
ON d.architecture = ifnull(r.architecture, d.architecture)
@@ -80,7 +80,7 @@ def main():
(source, version, architecture, success, timestamp,
filename))
if requestid is not None:
- cur.execute("DELETE FROM buildrequests WHERE rowid = ?;",
+ cur.execute("DELETE FROM buildrequests WHERE id = ?;",
(requestid,))
if giveback:
cur.execute("UPDATE depcheck SET giveback = 1 WHERE architecture = ?;",
diff --git a/schema.sql b/schema.sql
index 62ce9c4..d7854a2 100644
--- a/schema.sql
+++ b/schema.sql
@@ -32,6 +32,7 @@ CREATE TABLE builds (
filename TEXT NOT NULL);
CREATE TABLE buildrequests (
+ id INTEGER PRIMARY KEY,
source TEXT NOT NULL,
architecture TEXT,
requesttime TIMESTAMP NOT NULL,