here the whole table of my 30.0.1 but creating the tables manually is not required an IMHO would not resolve the initial issue with the rights - I would focus there.
table public.oc_ex_apps
created with docker compose exec -it db pg_dump -d nextcloud -U nextcloud --schema-only --table=public.oc_ex_apps
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.8 (Debian 15.8-1.pgdg120+1)
-- Dumped by pg_dump version 15.8 (Debian 15.8-1.pgdg120+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: oc_ex_apps; Type: TABLE; Schema: public; Owner: nextcloud
--
CREATE TABLE public.oc_ex_apps (
id bigint NOT NULL,
appid character varying(32) NOT NULL,
version character varying(32) NOT NULL,
name character varying(64) NOT NULL,
daemon_config_name character varying(64) DEFAULT '0'::character varying NOT NULL,
port smallint NOT NULL,
secret character varying(256) NOT NULL,
status json NOT NULL,
enabled smallint DEFAULT 0 NOT NULL,
created_time bigint NOT NULL
);
ALTER TABLE public.oc_ex_apps OWNER TO nextcloud;
--
-- Name: oc_ex_apps_id_seq; Type: SEQUENCE; Schema: public; Owner: nextcloud
--
CREATE SEQUENCE public.oc_ex_apps_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.oc_ex_apps_id_seq OWNER TO nextcloud;
--
-- Name: oc_ex_apps_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: nextcloud
--
ALTER SEQUENCE public.oc_ex_apps_id_seq OWNED BY public.oc_ex_apps.id;
--
-- Name: oc_ex_apps id; Type: DEFAULT; Schema: public; Owner: nextcloud
--
ALTER TABLE ONLY public.oc_ex_apps ALTER COLUMN id SET DEFAULT nextval('public.oc_ex_apps_id_seq'::regclass);
--
-- Name: oc_ex_apps oc_ex_apps_pkey; Type: CONSTRAINT; Schema: public; Owner: nextcloud
--
ALTER TABLE ONLY public.oc_ex_apps
ADD CONSTRAINT oc_ex_apps_pkey PRIMARY KEY (id);
--
-- Name: ex_apps__appid; Type: INDEX; Schema: public; Owner: nextcloud
--
CREATE UNIQUE INDEX ex_apps__appid ON public.oc_ex_apps USING btree (appid);
--
-- Name: ex_apps_c_port__idx; Type: INDEX; Schema: public; Owner: nextcloud
--
CREATE UNIQUE INDEX ex_apps_c_port__idx ON public.oc_ex_apps USING btree (daemon_config_name, port);
--
-- PostgreSQL database dump complete
--