From a2eccde5e1e83f77bd015990279f75f8b3c7db4a Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 24 Mar 2019 07:25:38 +0100 Subject: 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. --- build.py | 4 ++-- schema.sql | 1 + 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, -- cgit v1.2.3