From: Michael Tremer Date: Thu, 20 Jul 2023 10:14:04 +0000 (+0000) Subject: db: Sync schema X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ad621ea2fbf6d1c13e6cfb5b49f599c3ebf0e4a8;p=pbs.git db: Sync schema I don't quite know why the diff is so large when there have been only a few fields changed... Signed-off-by: Michael Tremer --- diff --git a/src/database.sql b/src/database.sql index cd53604c..0a8e2e51 100644 --- a/src/database.sql +++ b/src/database.sql @@ -27,52 +27,6 @@ SET default_tablespace = ''; SET default_table_access_method = heap; --- --- Name: build_groups; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.build_groups ( - id integer NOT NULL, - uuid uuid DEFAULT gen_random_uuid() NOT NULL, - created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by integer, - deleted_at timestamp without time zone, - deleted_by integer, - finished_at timestamp without time zone, - failed boolean DEFAULT false NOT NULL, - tested_build_id integer -); - - --- --- Name: builds; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.builds ( - id integer NOT NULL, - uuid uuid DEFAULT gen_random_uuid() NOT NULL, - pkg_id integer NOT NULL, - severity text, - message text, - created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - build_repo_id integer NOT NULL, - owner_id integer, - priority integer DEFAULT 0 NOT NULL, - finished_at timestamp without time zone, - failed boolean DEFAULT false NOT NULL, - deleted_at timestamp without time zone, - deleted_by integer, - build_group_id integer, - deprecating_build_id integer, - deprecated_at timestamp without time zone, - deprecated_by integer, - test_group_id integer, - test boolean DEFAULT false NOT NULL, - disable_test_builds boolean DEFAULT false NOT NULL, - points integer DEFAULT 0 NOT NULL -); - - -- -- Name: build_bugs; Type: TABLE; Schema: public; Owner: - -- @@ -89,265 +43,61 @@ CREATE TABLE public.build_bugs ( -- --- Name: build_comments; Type: TABLE; Schema: public; Owner: - +-- Name: build_bugs_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE TABLE public.build_comments ( - id integer NOT NULL, - build_id integer NOT NULL, - user_id integer NOT NULL, - text text DEFAULT ''::text NOT NULL, - created_at timestamp without time zone DEFAULT now() NOT NULL, - deleted boolean DEFAULT false NOT NULL -); +CREATE SEQUENCE public.build_bugs_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; -- --- Name: build_points; Type: TABLE; Schema: public; Owner: - +-- Name: build_bugs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -CREATE TABLE public.build_points ( - build_id integer NOT NULL, - created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - points integer DEFAULT 0 NOT NULL, - user_id integer -); +ALTER SEQUENCE public.build_bugs_id_seq OWNED BY public.build_bugs.id; -- --- Name: build_watchers; Type: TABLE; Schema: public; Owner: - +-- Name: build_comments; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.build_watchers ( +CREATE TABLE public.build_comments ( + id integer NOT NULL, build_id integer NOT NULL, user_id integer NOT NULL, - added_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - deleted_at timestamp without time zone + text text DEFAULT ''::text NOT NULL, + created_at timestamp without time zone DEFAULT now() NOT NULL, + deleted boolean DEFAULT false NOT NULL ); -- --- Name: builders; Type: TABLE; Schema: public; Owner: - +-- Name: build_groups; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.builders ( +CREATE TABLE public.build_groups ( id integer NOT NULL, - name text NOT NULL, - description text, - enabled boolean DEFAULT false NOT NULL, - loadavg text DEFAULT '0'::character varying NOT NULL, - maintenance boolean DEFAULT false NOT NULL, - max_jobs bigint DEFAULT (1)::bigint NOT NULL, - pakfire_version text, - os_name text, - cpu_model text, - cpu_count integer DEFAULT 1 NOT NULL, - host_key_id text, - updated_at timestamp without time zone, - cpu_arch text, - instance_id text, - instance_type text, - mem_total bigint, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, created_by integer, deleted_at timestamp without time zone, - deleted_by integer -); - - --- --- Name: jobs; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.jobs ( - id integer NOT NULL, - uuid uuid DEFAULT gen_random_uuid() NOT NULL, - build_id integer NOT NULL, - arch text NOT NULL, - created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - started_at timestamp without time zone, + deleted_by integer, finished_at timestamp without time zone, - builder_id integer, - message text, - superseeded_by integer, - installcheck_succeeded boolean, - installcheck_performed_at timestamp without time zone, failed boolean DEFAULT false NOT NULL, - log_path text, - log_size bigint, - log_digest_blake2s bytea, - deleted_at timestamp without time zone, - deleted_by integer, - aborted boolean DEFAULT false NOT NULL, - aborted_by integer -); - - --- --- Name: mirror_checks; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.mirror_checks ( - mirror_id integer NOT NULL, - checked_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - success boolean DEFAULT false NOT NULL, - response_time double precision, - http_status integer, - last_sync_at timestamp without time zone, - error text -); - - --- --- Name: mirrors; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.mirrors ( - id integer NOT NULL, - hostname text NOT NULL, - path text NOT NULL, - owner text, - contact text, - created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by integer NOT NULL, - deleted_at timestamp without time zone, - deleted_by integer, - last_check_success boolean, - last_check_at timestamp without time zone, - last_sync_at timestamp without time zone, - country_code text, - error text, - asn integer, - notes text DEFAULT ''::text NOT NULL -); - - --- --- Name: release_monitorings; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.release_monitorings ( - id integer NOT NULL, - distro_id integer NOT NULL, - name text NOT NULL, - created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by integer NOT NULL, - deleted_at timestamp without time zone, - deleted_by integer, - project_id integer NOT NULL, - follow text NOT NULL, - last_check_at timestamp without time zone, - create_builds boolean DEFAULT true NOT NULL -); - - --- --- Name: releases; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.releases ( - id integer NOT NULL, - distro_id integer NOT NULL, - name text NOT NULL, - slug text NOT NULL, - created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - created_by integer NOT NULL, - deleted_at timestamp without time zone, - deleted_by integer, - published_at timestamp without time zone, - stable boolean DEFAULT false NOT NULL, - announcement text -); - - --- --- Name: repository_builds; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.repository_builds ( - id integer NOT NULL, - repo_id integer NOT NULL, - build_id bigint NOT NULL, - added_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - added_by integer, - removed_at timestamp without time zone, - removed_by integer -); - - --- --- Name: packages; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.packages ( - id integer NOT NULL, - name text NOT NULL, - evr text NOT NULL, - arch text NOT NULL, - groups text NOT NULL, - packager text, - license text NOT NULL, - url text NOT NULL, - summary text NOT NULL, - description text NOT NULL, - size bigint NOT NULL, - supported_arches text, - uuid uuid NOT NULL, - commit_id integer, - build_id text, - build_host text NOT NULL, - build_time timestamp without time zone NOT NULL, - path text, - filesize bigint NOT NULL, - prerequires text[] DEFAULT ARRAY[]::text[] NOT NULL, - requires text[] DEFAULT ARRAY[]::text[] NOT NULL, - provides text[] DEFAULT ARRAY[]::text[] NOT NULL, - obsoletes text[] DEFAULT ARRAY[]::text[] NOT NULL, - conflicts text[] DEFAULT ARRAY[]::text[] NOT NULL, - recommends text[] DEFAULT ARRAY[]::text[] NOT NULL, - suggests text[] DEFAULT ARRAY[]::text[] NOT NULL, - created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - digest_type text NOT NULL, - digest bytea NOT NULL, - deleted_at timestamp without time zone, - deleted_by integer, - distro_id integer NOT NULL, - _search tsvector GENERATED ALWAYS AS (((setweight(to_tsvector('simple'::regconfig, name), 'A'::"char") || setweight(to_tsvector('english'::regconfig, summary), 'B'::"char")) || setweight(to_tsvector('english'::regconfig, description), 'C'::"char"))) STORED -); - - --- --- Name: job_packages; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.job_packages ( - job_id integer NOT NULL, - pkg_id integer NOT NULL -); - - --- --- Name: uploads; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.uploads ( - id integer NOT NULL, - uuid uuid DEFAULT gen_random_uuid() NOT NULL, - user_id integer, - builder_id integer, - filename text NOT NULL, - path text NOT NULL, - size bigint NOT NULL, - created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, - expires_at timestamp without time zone DEFAULT (CURRENT_TIMESTAMP + '24:00:00'::interval) NOT NULL + tested_build_id integer ); -- --- Name: build_bugs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: build_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.build_bugs_id_seq +CREATE SEQUENCE public.build_groups_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -357,41 +107,45 @@ CREATE SEQUENCE public.build_bugs_id_seq -- --- Name: build_bugs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: build_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.build_bugs_id_seq OWNED BY public.build_bugs.id; +ALTER SEQUENCE public.build_groups_id_seq OWNED BY public.build_groups.id; -- --- Name: build_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- Name: build_packages; Type: TABLE; Schema: public; Owner: - -- -CREATE SEQUENCE public.build_groups_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE TABLE public.build_packages ( + build_id integer NOT NULL, + package_id integer NOT NULL, + job_id integer NOT NULL, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); -- --- Name: build_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- Name: build_points; Type: TABLE; Schema: public; Owner: - -- -ALTER SEQUENCE public.build_groups_id_seq OWNED BY public.build_groups.id; +CREATE TABLE public.build_points ( + build_id integer NOT NULL, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + points integer DEFAULT 0 NOT NULL, + user_id integer +); -- --- Name: build_packages; Type: TABLE; Schema: public; Owner: - +-- Name: build_watchers; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.build_packages ( +CREATE TABLE public.build_watchers ( build_id integer NOT NULL, - package_id integer NOT NULL, - job_id integer NOT NULL, - created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL + user_id integer NOT NULL, + added_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + deleted_at timestamp without time zone ); @@ -430,6 +184,35 @@ CREATE TABLE public.builder_stats ( ); +-- +-- Name: builders; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.builders ( + id integer NOT NULL, + name text NOT NULL, + description text, + enabled boolean DEFAULT false NOT NULL, + loadavg text DEFAULT '0'::character varying NOT NULL, + maintenance boolean DEFAULT false NOT NULL, + max_jobs bigint DEFAULT (1)::bigint NOT NULL, + pakfire_version text, + os_name text, + cpu_model text, + cpu_count integer DEFAULT 1 NOT NULL, + host_key_id text, + updated_at timestamp without time zone, + cpu_arch text, + instance_id text, + instance_type text, + mem_total bigint, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + created_by integer, + deleted_at timestamp without time zone, + deleted_by integer +); + + -- -- Name: builders_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -449,6 +232,35 @@ CREATE SEQUENCE public.builders_id_seq ALTER SEQUENCE public.builders_id_seq OWNED BY public.builders.id; +-- +-- Name: builds; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.builds ( + id integer NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, + pkg_id integer NOT NULL, + severity text, + message text, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + build_repo_id integer NOT NULL, + owner_id integer, + priority integer DEFAULT 0 NOT NULL, + finished_at timestamp without time zone, + failed boolean DEFAULT false NOT NULL, + deleted_at timestamp without time zone, + deleted_by integer, + build_group_id integer, + deprecating_build_id integer, + deprecated_at timestamp without time zone, + deprecated_by integer, + test_group_id integer, + test boolean DEFAULT false NOT NULL, + disable_test_builds boolean DEFAULT false NOT NULL, + points integer DEFAULT 0 NOT NULL +); + + -- -- Name: builds_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -558,6 +370,44 @@ CREATE SEQUENCE public.images_types_id_seq ALTER SEQUENCE public.images_types_id_seq OWNED BY public.images_types.id; +-- +-- Name: job_packages; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.job_packages ( + job_id integer NOT NULL, + pkg_id integer NOT NULL +); + + +-- +-- Name: jobs; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.jobs ( + id integer NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, + build_id integer NOT NULL, + arch text NOT NULL, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + started_at timestamp without time zone, + finished_at timestamp without time zone, + builder_id integer, + message text, + superseeded_by integer, + installcheck_succeeded boolean, + installcheck_performed_at timestamp without time zone, + failed boolean DEFAULT false NOT NULL, + log_path text, + log_size bigint, + log_digest_blake2s bytea, + deleted_at timestamp without time zone, + deleted_by integer, + aborted boolean DEFAULT false NOT NULL, + aborted_by integer +); + + -- -- Name: jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -647,6 +497,45 @@ CREATE SEQUENCE public.messages_id_seq ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id; +-- +-- Name: mirror_checks; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mirror_checks ( + mirror_id integer NOT NULL, + checked_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + success boolean DEFAULT false NOT NULL, + response_time double precision, + http_status integer, + last_sync_at timestamp without time zone, + error text +); + + +-- +-- Name: mirrors; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mirrors ( + id integer NOT NULL, + hostname text NOT NULL, + path text NOT NULL, + owner text, + contact text, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + created_by integer NOT NULL, + deleted_at timestamp without time zone, + deleted_by integer, + last_check_success boolean, + last_check_at timestamp without time zone, + last_sync_at timestamp without time zone, + country_code text, + error text, + asn integer, + notes text DEFAULT ''::text NOT NULL +); + + -- -- Name: mirrors_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -691,6 +580,47 @@ CREATE TABLE public.package_files ( ); +-- +-- Name: packages; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.packages ( + id integer NOT NULL, + name text NOT NULL, + evr text NOT NULL, + arch text NOT NULL, + groups text NOT NULL, + packager text, + license text NOT NULL, + url text NOT NULL, + summary text NOT NULL, + description text NOT NULL, + size bigint NOT NULL, + supported_arches text, + uuid uuid NOT NULL, + commit_id integer, + build_id text, + build_host text NOT NULL, + build_time timestamp without time zone NOT NULL, + path text, + filesize bigint NOT NULL, + prerequires text[] DEFAULT ARRAY[]::text[] NOT NULL, + requires text[] DEFAULT ARRAY[]::text[] NOT NULL, + provides text[] DEFAULT ARRAY[]::text[] NOT NULL, + obsoletes text[] DEFAULT ARRAY[]::text[] NOT NULL, + conflicts text[] DEFAULT ARRAY[]::text[] NOT NULL, + recommends text[] DEFAULT ARRAY[]::text[] NOT NULL, + suggests text[] DEFAULT ARRAY[]::text[] NOT NULL, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + digest_type text NOT NULL, + digest bytea NOT NULL, + deleted_at timestamp without time zone, + deleted_by integer, + distro_id integer NOT NULL, + _search tsvector GENERATED ALWAYS AS (((setweight(to_tsvector('simple'::regconfig, name), 'A'::"char") || setweight(to_tsvector('english'::regconfig, summary), 'B'::"char")) || setweight(to_tsvector('english'::regconfig, description), 'C'::"char"))) STORED +); + + -- -- Name: packages_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -793,6 +723,25 @@ CREATE SEQUENCE public.release_monitoring_releases_id_seq ALTER SEQUENCE public.release_monitoring_releases_id_seq OWNED BY public.release_monitoring_releases.id; +-- +-- Name: release_monitorings; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.release_monitorings ( + id integer NOT NULL, + distro_id integer NOT NULL, + name text NOT NULL, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + created_by integer NOT NULL, + deleted_at timestamp without time zone, + deleted_by integer, + project_id integer NOT NULL, + follow text NOT NULL, + last_check_at timestamp without time zone, + create_builds boolean DEFAULT true NOT NULL +); + + -- -- Name: release_monitorings_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -813,6 +762,25 @@ CREATE SEQUENCE public.release_monitorings_id_seq ALTER SEQUENCE public.release_monitorings_id_seq OWNED BY public.release_monitorings.id; +-- +-- Name: releases; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.releases ( + id integer NOT NULL, + distro_id integer NOT NULL, + name text NOT NULL, + slug text NOT NULL, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + created_by integer NOT NULL, + deleted_at timestamp without time zone, + deleted_by integer, + published_at timestamp without time zone, + stable boolean DEFAULT false NOT NULL, + announcement text +); + + -- -- Name: releases_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -888,6 +856,21 @@ CREATE SEQUENCE public.repositories_id_seq ALTER SEQUENCE public.repositories_id_seq OWNED BY public.repositories.id; +-- +-- Name: repository_builds; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.repository_builds ( + id integer NOT NULL, + repo_id integer NOT NULL, + build_id bigint NOT NULL, + added_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + added_by integer, + removed_at timestamp without time zone, + removed_by integer +); + + -- -- Name: repository_builds_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -1035,7 +1018,7 @@ CREATE TABLE public.sources ( slug text NOT NULL, url text NOT NULL, gitweb text, - revision text NOT NULL, + revision text, branch text NOT NULL, last_fetched_at timestamp without time zone, repo_id integer NOT NULL, @@ -1065,6 +1048,23 @@ CREATE SEQUENCE public.sources_id_seq ALTER SEQUENCE public.sources_id_seq OWNED BY public.sources.id; +-- +-- Name: uploads; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.uploads ( + id integer NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, + user_id integer, + builder_id integer, + filename text NOT NULL, + path text NOT NULL, + size bigint NOT NULL, + created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, + expires_at timestamp without time zone DEFAULT (CURRENT_TIMESTAMP + '24:00:00'::interval) NOT NULL +); + + -- -- Name: uploads_id_seq; Type: SEQUENCE; Schema: public; Owner: - --