Goal
Consume manifest.data.apis entries with generated collection resources and emit Supabase/Postgres migration artifacts.
Context
The nutrition scanner challenge template now declares generated domain APIs for products, captures, challenges, and scan events through manifest.data.apis.
The current infra package already generates Supabase auth/profile artifacts, but does not appear to generate database tables from generated collection API resources yet.
Scope
For generated API entries where:
api.kind === 'generated'
api.resource.kind === 'collection'
emit a Supabase migration with create table if not exists statements for each collection.
Minimum field mapping:
uuid -> uuid
text -> text
number -> numeric
boolean -> boolean
datetime -> timestamptz
json -> jsonb
Minimum behavior:
- honor
collection.schema, collection.name, and collection.primaryKey
- honor field
required
- honor field
unique
- honor safe scalar defaults such as strings, numbers, and booleans
- enable RLS for generated tables when the API declares
auth.required = true
- add an authenticated read policy and a conservative authenticated insert policy for auth-required generated APIs
Acceptance criteria
- Supabase/minikube infra emits a domain data migration when generated collection APIs exist.
- Tests cover nutrition-like products, captures, challenges, and scan events.
- The generated migration contains the expected tables, columns, unique barcode constraint, jsonb nutrition fields, timestamptz fields, and RLS policies.
- Existing manifests without
manifest.data.apis remain backward compatible.
Goal
Consume
manifest.data.apisentries with generated collection resources and emit Supabase/Postgres migration artifacts.Context
The nutrition scanner challenge template now declares generated domain APIs for products, captures, challenges, and scan events through
manifest.data.apis.The current infra package already generates Supabase auth/profile artifacts, but does not appear to generate database tables from generated collection API resources yet.
Scope
For generated API entries where:
emit a Supabase migration with
create table if not existsstatements for each collection.Minimum field mapping:
uuid->uuidtext->textnumber->numericboolean->booleandatetime->timestamptzjson->jsonbMinimum behavior:
collection.schema,collection.name, andcollection.primaryKeyrequireduniqueauth.required = trueAcceptance criteria
manifest.data.apisremain backward compatible.