echo "SUPABASE_URL=$SUPABASE_URL"
echo "SUPABASE_PROJECT_REF=$SUPABASE_PROJECT_REF"
echo "SUPABASE_ANON_KEY=${SUPABASE_ANON_KEY:0:20}..."
echo "SUPABASE_SERVICE_ROLE_KEY=${SUPABASE_SERVICE_ROLE_KEY:0:20}..."
echo "SUPABASE_DB_URL=${SUPABASE_DB_URL:0:30}..."
echo "SUPABASE_DB_PASSWORD=${SUPABASE_DB_PASSWORD:0:5}..."SUPABASE_URL=https://<ref>.supabase.co SUPABASE_PROJECT_REF=<ref> SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIs... SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIs... SUPABASE_DB_URL=postgresql://postgres.pgepczua... SUPABASE_DB_PASSWORD=1a9f7...
cat <<'EOF' > /tmp/schema.sql -- 1. authors CREATE TABLE public.authors ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), name text NOT NULL, email text NOT NULL UNIQUE ); -- 2. courses 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() ); -- 3. enrollments 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) ); -- Indexes CREATE INDEX idx_courses_author_id ON public.courses(author_id); CREATE INDEX idx_enrollments_student ON public.enrollments(student_email); -- Enable PostgREST access (Supabase auto-picks up public schema tables, -- but let's be explicit by granting usage to the roles PostgREST uses). -- Grant usage on the public schema GRANT USAGE ON SCHEMA public TO anon, authenticated, service_role; -- Grant SELECT (and necessary DML) on the new tables GRANT SELECT, INSERT, UPDATE, DELETE ON public.authors TO anon, authenticated, service_role; GRANT SELECT, INSERT, UPDATE, DELETE ON public.courses TO anon, authenticated, service_role; GRANT SELECT, INSERT, UPDATE, DELETE ON public.enrollments TO anon, authenticated, service_role; -- For identity columns the role needs USAGE on the sequence GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO anon, authenticated, service_role; EOF echo "SQL file written"
SQL file written
psql "$SUPABASE_DB_URL" -f /tmp/schema.sql
CREATE TABLE CREATE TABLE CREATE TABLE CREATE INDEX CREATE INDEX GRANT GRANT GRANT GRANT GRANT
# Quick psql check 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)
# Test REST API with anon key (courses endpoint)
curl -s -o /dev/null -w "%{http_code}" \
-H "apikey: $SUPABASE_ANON_KEY" \
-H "Authorization: Bearer $SUPABASE_ANON_KEY" \
"$SUPABASE_URL/rest/v1/courses?select=*" 200
# Test authors and enrollments endpoints too
echo -n "authors: "
curl -s -o /dev/null -w "%{http_code}" \
-H "apikey: $SUPABASE_ANON_KEY" \
-H "Authorization: Bearer $SUPABASE_ANON_KEY" \
"$SUPABASE_URL/rest/v1/authors?select=*"
echo ""
echo -n "enrollments: "
curl -s -o /dev/null -w "%{http_code}" \
-H "apikey: $SUPABASE_ANON_KEY" \
-H "Authorization: Bearer $SUPABASE_ANON_KEY" \
"$SUPABASE_URL/rest/v1/enrollments?select=*"
echo ""authors: 200 enrollments: 200
1 earlier narration turn(s) are in the raw transcript.
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