echo "URL: $SUPABASE_URL" && echo "Ref: $SUPABASE_PROJECT_REF" && echo "DB URL exists: $( [ -n "$SUPABASE_DB_URL" ] && echo yes || echo no )"
URL: https://<ref>.supabase.co Ref: <ref> DB URL exists: yes
psql "$SUPABASE_DB_URL" <<'SQL'
-- Create authors table
CREATE TABLE public.authors (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
name text NOT NULL,
email text NOT NULL UNIQUE
);
-- Create courses table
CREATE TABLE public.courses (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
author_id uuid NOT NULL REFERENCES public.authors(id),
title text NOT NULL,
price_cents integer NOT NULL CHECK (price_cents >= 0),
published boolean NOT NULL DEFAULT false,
created_at timestamptz NOT NULL DEFAULT now()
);
-- Create enrollments table
CREATE TABLE public.enrollments (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
course_id uuid NOT NULL REFERENCES public.courses(id) ON DELETE CASCADE,
student_email text NOT NULL,
enrolled_at timestamptz NOT NULL DEFAULT now(),
UNIQUE (course_id, student_email)
);
-- Create indexes
CREATE INDEX idx_courses_author_id ON public.courses(author_id);
CREATE INDEX idx_enrollments_student_email ON public.enrollments(student_email);
SQLCREATE TABLE CREATE TABLE CREATE TABLE CREATE INDEX CREATE INDEX
psql "$SUPABASE_DB_URL" -c "\dt public.*"
List of tables Schema | Name | Type | Owner --------+-------------+-------+---------- public | authors | table | postgres public | courses | table | postgres public | enrollments | table | postgres (3 rows)
curl -s -w "\nHTTP_STATUS: %{http_code}" "$SUPABASE_URL/rest/v1/courses" -H "apikey: $SUPABASE_ANON_KEY" -H "Authorization: Bearer $SUPABASE_ANON_KEY" 2>&1 | tail -5[] HTTP_STATUS: 200
curl -s "$SUPABASE_URL/rest/v1/authors" -H "apikey: $SUPABASE_ANON_KEY" | head -c 200 && echo "" && curl -s "$SUPABASE_URL/rest/v1/enrollments" -H "apikey: $SUPABASE_ANON_KEY" | head -c 200
[] []
psql "$SUPABASE_DB_URL" <<'SQL'
-- Verify authors
SELECT 'authors' as tbl, column_name, data_type, is_nullable, column_default
FROM information_schema.columns
WHERE table_schema='public' AND table_name='authors'
ORDER BY ordinal_position;
-- Verify courses
SELECT 'courses' as tbl, column_name, data_type, is_nullable, column_default
FROM information_schema.columns
WHERE table_schema='public' AND table_name='courses'
ORDER BY ordinal_position;
-- Verify enrollments
SELECT 'enrollments' as tbl, column_name, data_type, is_nullable, column_default
FROM information_schema.columns
WHERE table_schema='public' AND table_name='enrollments'
ORDER BY ordinal_position;
-- Check constraints
SELECT conname, contype, pg_get_constraintdef(oid) as def
FROM pg_constraint
WHERE conrelid IN ('public.authors'::regclass, 'public.courses'::regclass, 'public.enrollments'::regclass)
ORDER BY conrelid, conname;
-- Check indexes
SELECT tablename, indexname FROM pg_indexes WHERE schemaname='public' ORDER BY tablename, indexname;
SQL tbl | column_name | data_type | is_nullable | column_default
---------+-------------+-----------+-------------+-------------------
authors | id | uuid | NO | gen_random_uuid()
authors | name | text | NO |
authors | email | text | NO |
(3 rows)
tbl | column_name | data_type | is_nullable | column_default
---------+-------------+--------------------------+-------------+-------------------
courses | id | uuid | NO | gen_random_uuid()
courses | author_id | uuid | NO |
courses | title | text | NO |
courses | price_cents | integer | NO |
courses | published | boolean | NO | false
courses | created_at | timestamp with time zone | NO | now()
(6 rows)
tbl | column_name | data_type | is_nullable | column_default
-------------+---------------+--------------------------+-------------+----------------
enrollments | id | bigint | NO |
enrollments | course_id | uuid | NO |
enrollments | student_email | text | NO |
enrollments | enrolled_at | timestamp with time zone | NO | now()
(4 rows)
conname | contype | def
-----------------------------------------+---------+------------------------------------------------------------------
authors_email_key | u | UNIQUE (email)
authors_pkey | p | PRIMARY KEY (id)
courses_author_id_fkey | f | FOREIGN KEY (author_id) REFERENCES authors(id)
courses_pkey | p | PRIMARY KEY (id)
courses_price_cents_check | c | CHECK ((price_cents >= 0))
enrollments_course_id_fkey | f | FOREIGN KEY (course_id) REFERENCES courses(id) ON DELETE CASCADE
enrollments_course_id_student_email_key | u | UNIQUE (course_id, student_email)
enrollments_pkey | p | PRIMARY KEY (id)
(8 rows)
tablename | indexname
-------------+-----------------------------------------
authors | authors_email_key
authors | authors_pkey
courses | courses_pkey
courses | idx_courses_author_id
enrollments | enrollments_course_id_student_email_key
enrollments | enrollments_pkey
enrollments | idx_enrollments_student_email
(7 rows)
A shell script executed against the live project and asserted on the state the agent left behind. No model judged another model.
Raw transcript · Task definition and verifier · Every attempt