@@ -135,6 +135,20 @@ CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
135135COMMENT ON EXTENSION " uuid-ossp" IS ' generate universally unique identifiers (UUIDs)' ;
136136
137137
138+ --
139+ -- Name: ingestion_message_severity; Type: TYPE; Schema: public; Owner: -
140+ --
141+
142+ CREATE TYPE public .ingestion_message_severity AS ENUM (
143+ ' unknown' ,
144+ ' debug' ,
145+ ' info' ,
146+ ' warn' ,
147+ ' error' ,
148+ ' fatal'
149+ );
150+
151+
138152--
139153-- Name: manifold_lang; Type: TYPE; Schema: public; Owner: -
140154--
@@ -145,6 +159,36 @@ CREATE TYPE public.manifold_lang AS ENUM (
145159);
146160
147161
162+ --
163+ -- Name: extract_ingestion_message_severity(jsonb); Type: FUNCTION; Schema: public; Owner: -
164+ --
165+
166+ CREATE FUNCTION public .extract_ingestion_message_severity(jsonb) RETURNS public .ingestion_message_severity
167+ LANGUAGE sql IMMUTABLE PARALLEL SAFE
168+ AS $_$
169+ SELECT
170+ CASE
171+ WHEN jsonb_typeof($1 ) = ' array' THEN public .normalize_ingestion_message_severity ($1 - >> 0 )
172+ ELSE ' unknown' ::public .ingestion_message_severity
173+ END;
174+ $_$;
175+
176+
177+ --
178+ -- Name: extract_ingestion_message_text(jsonb); Type: FUNCTION; Schema: public; Owner: -
179+ --
180+
181+ CREATE FUNCTION public .extract_ingestion_message_text(jsonb) RETURNS text
182+ LANGUAGE sql IMMUTABLE PARALLEL SAFE
183+ AS $_$
184+ SELECT
185+ CASE
186+ WHEN jsonb_typeof($1 ) = ' array' THEN $1 - >> 1
187+ ELSE NULL
188+ END;
189+ $_$;
190+
191+
148192--
149193-- Name: extract_text_section_content(jsonb); Type: FUNCTION; Schema: public; Owner: -
150194--
@@ -258,6 +302,25 @@ CREATE FUNCTION public.manifold_slugify(text) RETURNS text
258302$_$;
259303
260304
305+ --
306+ -- Name: normalize_ingestion_message_severity(text); Type: FUNCTION; Schema: public; Owner: -
307+ --
308+
309+ CREATE FUNCTION public .normalize_ingestion_message_severity(text ) RETURNS public .ingestion_message_severity
310+ LANGUAGE sql IMMUTABLE PARALLEL SAFE
311+ AS $_$
312+ SELECT
313+ CASE LOWER ($1 )
314+ WHEN ' debug' THEN ' debug' ::public .ingestion_message_severity
315+ WHEN ' info' THEN ' info' ::public .ingestion_message_severity
316+ WHEN ' warn' THEN ' warn' ::public .ingestion_message_severity
317+ WHEN ' error' THEN ' error' ::public .ingestion_message_severity
318+ WHEN ' fatal' THEN ' fatal' ::public .ingestion_message_severity
319+ ELSE ' unknown' ::public .ingestion_message_severity
320+ END;
321+ $_$;
322+
323+
261324--
262325-- Name: to_unaccented_tsv(jsonb); Type: FUNCTION; Schema: public; Owner: -
263326--
@@ -1674,7 +1737,8 @@ CREATE TABLE public.ingestion_messages (
16741737 kind text NOT NULL ,
16751738 payload jsonb NOT NULL ,
16761739 created_at timestamp (6 ) without time zone NOT NULL ,
1677- updated_at timestamp (6 ) without time zone NOT NULL
1740+ updated_at timestamp (6 ) without time zone NOT NULL ,
1741+ severity public .ingestion_message_severity DEFAULT ' unknown' ::public .ingestion_message_severity NOT NULL
16781742);
16791743
16801744
@@ -4929,6 +4993,13 @@ CREATE INDEX index_import_selections_on_source_text_id ON public.import_selectio
49294993CREATE INDEX index_import_selections_on_text_id ON public .import_selections USING btree (text_id);
49304994
49314995
4996+ --
4997+ -- Name: index_ingestion_messages_on_extracted_text; Type: INDEX; Schema: public; Owner: -
4998+ --
4999+
5000+ CREATE INDEX index_ingestion_messages_on_extracted_text ON public .ingestion_messages USING btree (public .extract_ingestion_message_text (payload)) WHERE (kind = ' log' ::text );
5001+
5002+
49325003--
49335004-- Name: index_ingestion_messages_on_ingestion_id; Type: INDEX; Schema: public; Owner: -
49345005--
@@ -7770,6 +7841,7 @@ INSERT INTO "schema_migrations" (version) VALUES
77707841(' 20250609192241' ),
77717842(' 20251016204352' ),
77727843(' 20251017174417' ),
7773- (' 20251017211501' );
7844+ (' 20251017211501' ),
7845+ (' 20251020225421' );
77747846
77757847
0 commit comments