]> git.ipfire.org Git - pbs.git/commitdiff
Use native UUID type for packages, builds and jobs
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 21 Jun 2022 10:19:16 +0000 (10:19 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 21 Jun 2022 10:19:16 +0000 (10:19 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/builds.py
src/buildservice/jobs.py
src/database.sql

index e2906fd36c4b2721e35fd36c018879f2339bfbe0..d8909acd93cca6b7d43f588cacc9dd02c4b2a4f6 100644 (file)
@@ -3,7 +3,6 @@
 import logging
 import os
 import re
-import uuid
 
 from . import base
 from . import logs
@@ -183,8 +182,8 @@ class Builds(base.Object):
                        priority = -1
 
                # Create build in database
-               build = self._get_build("INSERT INTO builds(uuid, pkg_id, type, distro_id, priority) \
-                       VALUES(%s, %s, %s, %s, %s) RETURNING *", "%s" % uuid.uuid4(), pkg.id, type, distro.id, priority)
+               build = self._get_build("INSERT INTO builds(pkg_id, type, distro_id, priority) \
+                       VALUES(%s, %s, %s, %s) RETURNING *", pkg.id, type, distro.id, priority)
 
                # Set the owner of this build
                if owner:
index 54c1dade646b16b834bd4d4363d78b90d2cbedc5..38c2e5b39b01d1d951ea64c4fdd95933aaf3bc45 100644 (file)
@@ -5,7 +5,6 @@ import hashlib
 import logging
 import os
 import shutil
-import uuid
 
 import pakfire
 import pakfire.config
@@ -35,8 +34,8 @@ class Jobs(base.Object):
                        yield Job(self.backend, row.id, data=row)
 
        def create(self, build, arch, test=False, superseeds=None):
-               job = self._get_job("INSERT INTO jobs(uuid, build_id, arch, test) \
-                       VALUES(%s, %s, %s, %s) RETURNING *", "%s" % uuid.uuid4(), build.id, arch, test)
+               job = self._get_job("INSERT INTO jobs(build_id, arch, test) \
+                       VALUES(%s, %s, %s) RETURNING *", build.id, arch, test)
                job.log("created")
 
                # Set cache for Build object.
index 600b521da0c69d48abcf7b3f7c8eca50a685a7b6..90ba1c0c94865436455f2aa5158fb682ca326ea7 100644 (file)
@@ -200,7 +200,7 @@ ALTER SEQUENCE public.builders_id_seq OWNED BY public.builders.id;
 
 CREATE TABLE public.builds (
     id integer NOT NULL,
-    uuid text NOT NULL,
+    uuid uuid DEFAULT gen_random_uuid() NOT NULL,
     pkg_id integer NOT NULL,
     type text DEFAULT 'release'::text NOT NULL,
     state text DEFAULT 'building'::text NOT NULL,
@@ -394,7 +394,7 @@ ALTER SEQUENCE public.builds_id_seq OWNED BY public.builds.id;
 
 CREATE TABLE public.jobs (
     id integer NOT NULL,
-    uuid text NOT NULL,
+    uuid uuid DEFAULT gen_random_uuid() NOT NULL,
     build_id integer NOT NULL,
     state text DEFAULT 'pending'::text NOT NULL,
     arch text NOT NULL,
@@ -612,7 +612,7 @@ ALTER TABLE public.job_queue OWNER TO pakfire;
 
 CREATE TABLE public.jobs_buildroots (
     job_id integer NOT NULL,
-    pkg_uuid text NOT NULL,
+    pkg_uuid uuid NOT NULL,
     pkg_name text NOT NULL
 );
 
@@ -978,7 +978,7 @@ CREATE TABLE public.packages (
     description text NOT NULL,
     size bigint NOT NULL,
     supported_arches text,
-    uuid text NOT NULL,
+    uuid uuid NOT NULL,
     commit_id integer,
     build_id text NOT NULL,
     build_host text NOT NULL,