fix(db): update SQL default values and types for consistency
Some checks failed
CI / build-and-test (push) Failing after -31m34s
Some checks failed
CI / build-and-test (push) Failing after -31m34s
* Corrected default values for various fields in SQL schema * Changed tags field type from text[] to text[] with proper default * Updated JSONB default values to remove unnecessary quotes
This commit is contained in:
@@ -119,7 +119,7 @@ CREATE TABLE IF NOT EXISTS public.important_dates (
|
||||
id uuid NOT NULL DEFAULT gen_random_uuid(),
|
||||
notes text,
|
||||
recurring_yearly boolean NOT NULL DEFAULT false,
|
||||
reminder_days_before integer NOT NULL DEFAULT '7',
|
||||
reminder_days_before integer NOT NULL DEFAULT 7,
|
||||
title text NOT NULL
|
||||
);
|
||||
|
||||
@@ -129,7 +129,7 @@ CREATE TABLE IF NOT EXISTS public.thoughts (
|
||||
created_at timestamptz DEFAULT now(),
|
||||
guid uuid NOT NULL DEFAULT gen_random_uuid(),
|
||||
id bigserial NOT NULL,
|
||||
metadata jsonb DEFAULT '''{}''::jsonb',
|
||||
metadata jsonb DEFAULT '{}'::jsonb,
|
||||
project_id uuid,
|
||||
updated_at timestamptz DEFAULT now()
|
||||
);
|
||||
@@ -174,7 +174,7 @@ CREATE TABLE IF NOT EXISTS public.professional_contacts (
|
||||
name text NOT NULL,
|
||||
notes text,
|
||||
phone text,
|
||||
tags text[] NOT NULL DEFAULT '''{}''',
|
||||
tags text[] NOT NULL DEFAULT '{}',
|
||||
title text,
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
@@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS public.stored_files (
|
||||
CREATE TABLE IF NOT EXISTS public.household_items (
|
||||
category text,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
details jsonb NOT NULL DEFAULT '''{}''',
|
||||
details jsonb NOT NULL DEFAULT '{}',
|
||||
id uuid NOT NULL DEFAULT gen_random_uuid(),
|
||||
location text,
|
||||
name text NOT NULL,
|
||||
@@ -271,14 +271,14 @@ CREATE TABLE IF NOT EXISTS public.recipes (
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
cuisine text,
|
||||
id uuid NOT NULL DEFAULT gen_random_uuid(),
|
||||
ingredients jsonb NOT NULL DEFAULT '''[]''',
|
||||
instructions jsonb NOT NULL DEFAULT '''[]''',
|
||||
ingredients jsonb NOT NULL DEFAULT '[]',
|
||||
instructions jsonb NOT NULL DEFAULT '[]',
|
||||
name text NOT NULL,
|
||||
notes text,
|
||||
prep_time_minutes integer,
|
||||
rating integer,
|
||||
servings integer,
|
||||
tags text[] NOT NULL DEFAULT '''{}''',
|
||||
tags text[] NOT NULL DEFAULT '{}',
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
@@ -297,7 +297,7 @@ CREATE TABLE IF NOT EXISTS public.meal_plans (
|
||||
CREATE TABLE IF NOT EXISTS public.shopping_lists (
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
id uuid NOT NULL DEFAULT gen_random_uuid(),
|
||||
items jsonb NOT NULL DEFAULT '''[]''',
|
||||
items jsonb NOT NULL DEFAULT '[]',
|
||||
notes text,
|
||||
updated_at timestamptz NOT NULL DEFAULT now(),
|
||||
week_start date NOT NULL
|
||||
@@ -308,8 +308,8 @@ CREATE TABLE IF NOT EXISTS public.chat_histories (
|
||||
channel text,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
id uuid NOT NULL DEFAULT gen_random_uuid(),
|
||||
messages jsonb NOT NULL DEFAULT '''[]''',
|
||||
metadata jsonb NOT NULL DEFAULT '''{}''',
|
||||
messages jsonb NOT NULL DEFAULT '[]',
|
||||
metadata jsonb NOT NULL DEFAULT '{}',
|
||||
project_id uuid,
|
||||
session_id text NOT NULL,
|
||||
summary text,
|
||||
@@ -345,7 +345,7 @@ CREATE TABLE IF NOT EXISTS public.learnings (
|
||||
status text NOT NULL DEFAULT 'pending',
|
||||
summary text NOT NULL,
|
||||
supersedes_learning_id uuid,
|
||||
tags text[] NOT NULL DEFAULT '''{}''',
|
||||
tags text[] NOT NULL DEFAULT '{}',
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
@@ -362,7 +362,7 @@ CREATE TABLE IF NOT EXISTS public.plans (
|
||||
reviewed_by text,
|
||||
status text NOT NULL DEFAULT 'draft',
|
||||
supersedes_plan_id uuid,
|
||||
tags text[] NOT NULL DEFAULT '''{}''',
|
||||
tags text[] NOT NULL DEFAULT '{}',
|
||||
title text NOT NULL,
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
@@ -401,7 +401,7 @@ CREATE TABLE IF NOT EXISTS public.agent_skills (
|
||||
description text NOT NULL DEFAULT '',
|
||||
id uuid NOT NULL DEFAULT gen_random_uuid(),
|
||||
name text NOT NULL,
|
||||
tags text[] NOT NULL DEFAULT '''{}''',
|
||||
tags text[] NOT NULL DEFAULT '{}',
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
@@ -412,7 +412,7 @@ CREATE TABLE IF NOT EXISTS public.agent_guardrails (
|
||||
id uuid NOT NULL DEFAULT gen_random_uuid(),
|
||||
name text NOT NULL,
|
||||
severity text NOT NULL DEFAULT 'medium',
|
||||
tags text[] NOT NULL DEFAULT '''{}''',
|
||||
tags text[] NOT NULL DEFAULT '{}',
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
@@ -751,7 +751,7 @@ BEGIN
|
||||
AND table_name = 'important_dates'
|
||||
AND column_name = 'reminder_days_before'
|
||||
) THEN
|
||||
ALTER TABLE public.important_dates ADD COLUMN reminder_days_before integer NOT NULL DEFAULT '7';
|
||||
ALTER TABLE public.important_dates ADD COLUMN reminder_days_before integer NOT NULL DEFAULT 7;
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -842,7 +842,7 @@ BEGIN
|
||||
AND table_name = 'thoughts'
|
||||
AND column_name = 'metadata'
|
||||
) THEN
|
||||
ALTER TABLE public.thoughts ADD COLUMN metadata jsonb DEFAULT '''{}''::jsonb';
|
||||
ALTER TABLE public.thoughts ADD COLUMN metadata jsonb DEFAULT '{}'::jsonb;
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -1271,7 +1271,7 @@ BEGIN
|
||||
AND table_name = 'professional_contacts'
|
||||
AND column_name = 'tags'
|
||||
) THEN
|
||||
ALTER TABLE public.professional_contacts ADD COLUMN tags text[] NOT NULL DEFAULT '''{}''';
|
||||
ALTER TABLE public.professional_contacts ADD COLUMN tags text[] NOT NULL DEFAULT '{}';
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -1739,7 +1739,7 @@ BEGIN
|
||||
AND table_name = 'household_items'
|
||||
AND column_name = 'details'
|
||||
) THEN
|
||||
ALTER TABLE public.household_items ADD COLUMN details jsonb NOT NULL DEFAULT '''{}''';
|
||||
ALTER TABLE public.household_items ADD COLUMN details jsonb NOT NULL DEFAULT '{}';
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -2220,7 +2220,7 @@ BEGIN
|
||||
AND table_name = 'recipes'
|
||||
AND column_name = 'ingredients'
|
||||
) THEN
|
||||
ALTER TABLE public.recipes ADD COLUMN ingredients jsonb NOT NULL DEFAULT '''[]''';
|
||||
ALTER TABLE public.recipes ADD COLUMN ingredients jsonb NOT NULL DEFAULT '[]';
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -2233,7 +2233,7 @@ BEGIN
|
||||
AND table_name = 'recipes'
|
||||
AND column_name = 'instructions'
|
||||
) THEN
|
||||
ALTER TABLE public.recipes ADD COLUMN instructions jsonb NOT NULL DEFAULT '''[]''';
|
||||
ALTER TABLE public.recipes ADD COLUMN instructions jsonb NOT NULL DEFAULT '[]';
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -2311,7 +2311,7 @@ BEGIN
|
||||
AND table_name = 'recipes'
|
||||
AND column_name = 'tags'
|
||||
) THEN
|
||||
ALTER TABLE public.recipes ADD COLUMN tags text[] NOT NULL DEFAULT '''{}''';
|
||||
ALTER TABLE public.recipes ADD COLUMN tags text[] NOT NULL DEFAULT '{}';
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -2480,7 +2480,7 @@ BEGIN
|
||||
AND table_name = 'shopping_lists'
|
||||
AND column_name = 'items'
|
||||
) THEN
|
||||
ALTER TABLE public.shopping_lists ADD COLUMN items jsonb NOT NULL DEFAULT '''[]''';
|
||||
ALTER TABLE public.shopping_lists ADD COLUMN items jsonb NOT NULL DEFAULT '[]';
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -2584,7 +2584,7 @@ BEGIN
|
||||
AND table_name = 'chat_histories'
|
||||
AND column_name = 'messages'
|
||||
) THEN
|
||||
ALTER TABLE public.chat_histories ADD COLUMN messages jsonb NOT NULL DEFAULT '''[]''';
|
||||
ALTER TABLE public.chat_histories ADD COLUMN messages jsonb NOT NULL DEFAULT '[]';
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -2597,7 +2597,7 @@ BEGIN
|
||||
AND table_name = 'chat_histories'
|
||||
AND column_name = 'metadata'
|
||||
) THEN
|
||||
ALTER TABLE public.chat_histories ADD COLUMN metadata jsonb NOT NULL DEFAULT '''{}''';
|
||||
ALTER TABLE public.chat_histories ADD COLUMN metadata jsonb NOT NULL DEFAULT '{}';
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -2987,7 +2987,7 @@ BEGIN
|
||||
AND table_name = 'learnings'
|
||||
AND column_name = 'tags'
|
||||
) THEN
|
||||
ALTER TABLE public.learnings ADD COLUMN tags text[] NOT NULL DEFAULT '''{}''';
|
||||
ALTER TABLE public.learnings ADD COLUMN tags text[] NOT NULL DEFAULT '{}';
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -3169,7 +3169,7 @@ BEGIN
|
||||
AND table_name = 'plans'
|
||||
AND column_name = 'tags'
|
||||
) THEN
|
||||
ALTER TABLE public.plans ADD COLUMN tags text[] NOT NULL DEFAULT '''{}''';
|
||||
ALTER TABLE public.plans ADD COLUMN tags text[] NOT NULL DEFAULT '{}';
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -3481,7 +3481,7 @@ BEGIN
|
||||
AND table_name = 'agent_skills'
|
||||
AND column_name = 'tags'
|
||||
) THEN
|
||||
ALTER TABLE public.agent_skills ADD COLUMN tags text[] NOT NULL DEFAULT '''{}''';
|
||||
ALTER TABLE public.agent_skills ADD COLUMN tags text[] NOT NULL DEFAULT '{}';
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -3585,7 +3585,7 @@ BEGIN
|
||||
AND table_name = 'agent_guardrails'
|
||||
AND column_name = 'tags'
|
||||
) THEN
|
||||
ALTER TABLE public.agent_guardrails ADD COLUMN tags text[] NOT NULL DEFAULT '''{}''';
|
||||
ALTER TABLE public.agent_guardrails ADD COLUMN tags text[] NOT NULL DEFAULT '{}';
|
||||
END IF;
|
||||
END;
|
||||
$$;
|
||||
@@ -4574,7 +4574,7 @@ CREATE INDEX IF NOT EXISTS idx_learnings_tags
|
||||
ON public.learnings USING gin (tags gin_trgm_ops);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_plans_tags
|
||||
ON public.plans USING gin (tags gin_trgm_ops);
|
||||
ON public.plans USING gin (tags);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_plans_title
|
||||
ON public.plans USING gin (title gin_trgm_ops);
|
||||
|
||||
Reference in New Issue
Block a user