Goal
Consume the canonical generated API desired-state contract established by ankhorage/studio#120 and emit provider-owned Supabase/Postgres migration artifacts for generated collection resources.
This issue is the database-infrastructure bridge for generated API authoring. It does not generate an HTTP/GraphQL server, Fastify application, Docker image or Minikube API workload.
Dependency and release boundary
Blocked by the released Contracts/Data Sources phases of:
ankhorage/studio#120 — [adm 5] Rebuild generated API authoring and canonical API source model
Do not implement against an unreleased workspace-only contract. Do not retain or add a compatibility path for the historical manifest.data.apis shape.
Architecture boundary
The generated API flow has two related outputs:
GeneratedApiDefinition
canonical desired state authored by Studio
resources, fields, CRUD selection, seeds, supported policy intent
-> @ankhorage/data-sources
ApiDataSourceConfig
normalized runtime/binding projection
kind: api
origin: generated
protocol: rest for the initial restored CRUD flow
endpoints, operations and schemas
-> @ankhorage/infra
Database migration artifacts
provider-owned tables, columns, constraints and supported policies
Infra consumes the canonical generated desired-state definition for physical database generation. It must not infer provider-specific SQL from the normalized runtime operation projection when the desired-state resource definition is the authoritative source.
Scope
For each supported generated collection resource, emit deterministic Supabase/Postgres migrations.
Minimum field mapping:
uuid -> uuid
text / canonical string type -> text
number -> numeric
boolean -> boolean
datetime -> timestamptz
json -> jsonb
Minimum behavior:
- honor canonical schema/table/collection name;
- honor primary key;
- honor field
required;
- honor field
unique;
- honor safe scalar defaults such as strings, numbers and booleans;
- preserve stable generated resource IDs in artifact metadata where Infra conventions support it;
- generate deterministic migration names/content/order;
- apply supported auth/policy intent only through current Infra/provider ownership;
- enable RLS and generate supported policies only when explicitly declared by the canonical generated definition;
- reject unsupported or conflicting definitions with structured diagnostics rather than silently weakening them.
Explicit non-goals
Do not implement in this issue:
- a Fastify API generator;
- a GraphQL server generator;
- an
infra.backend contract;
- an API-generator adapter placeholder;
- Docker image generation for a generated API service;
- Kubernetes Deployment/Service resources for an API server;
- a legacy
manifest.data.apis reader;
- dual old/new generated API contract support;
- Studio UI or data-source normalization logic.
A future real HTTP/GraphQL generator requires a separately agreed package owner and implementation issue before any generator-adapter reference is added to canonical contracts.
Ownership
@ankhorage/contracts
generated API desired-state types
@ankhorage/data-sources
validation and generated definition -> normalized API operations
@ankhorage/infra
generated resource -> provider-specific migration/artifact mapping
@ankhorage/studio
authoring and persistence only
Required investigation
Before implementation:
- inspect the released canonical generated API definition;
- inspect current Infra provider/migration ownership and artifact APIs;
- identify the current Supabase/Postgres field/default/policy helpers;
- confirm the canonical manifest location consumed by Infra;
- search for every remaining
manifest.data.apis, AppGeneratedApiDefinition and old generated-dataset assumption;
- remove obsolete readers rather than preserving a fallback;
- confirm whether seeds are migration-owned, runtime bootstrap-owned or intentionally unsupported before implementing seed emission.
Tests
Cover at minimum:
- one generated resource -> one deterministic migration/table;
- multiple resources and deterministic ordering;
- schema/table/primary-key mapping;
- all supported field type mappings;
- required ->
not null;
- unique constraints;
- safe scalar defaults;
- JSON and datetime fields;
- supported RLS/policy mapping;
- invalid identifiers and duplicate/conflicting resources/fields;
- idempotent artifact generation;
- no artifact for external API sources;
- no HTTP service/container/Kubernetes API workload generation;
- no historical
manifest.data.apis compatibility path.
Use representative generated resources such as products, captures, challenges or scan events only as test fixtures; do not couple Infra to those application domains.
Acceptance criteria
- Infra consumes the released canonical generated API desired-state contract from
[adm 5].
- Supported generated collection resources produce deterministic Supabase/Postgres migrations.
- Schema, table, primary key, fields, required, unique and supported defaults are preserved.
- Supported auth/RLS/policy intent is mapped only by the owning Infra/provider implementation.
- Invalid/conflicting definitions produce useful diagnostics.
- External API data sources do not produce database migrations.
- No Fastify/GraphQL server, Docker API image, Minikube API workload or speculative generator adapter is added.
- No legacy/compatibility reader for
manifest.data.apis remains.
- Tests, generated docs, changeset, build, lint, format, Knip and typecheck pass.
- The resulting released Infra package can be consumed by the Studio phase of
ankhorage/studio#120.
Goal
Consume the canonical generated API desired-state contract established by
ankhorage/studio#120and emit provider-owned Supabase/Postgres migration artifacts for generated collection resources.This issue is the database-infrastructure bridge for generated API authoring. It does not generate an HTTP/GraphQL server, Fastify application, Docker image or Minikube API workload.
Dependency and release boundary
Blocked by the released Contracts/Data Sources phases of:
ankhorage/studio#120—[adm 5] Rebuild generated API authoring and canonical API source modelDo not implement against an unreleased workspace-only contract. Do not retain or add a compatibility path for the historical
manifest.data.apisshape.Architecture boundary
The generated API flow has two related outputs:
Infra consumes the canonical generated desired-state definition for physical database generation. It must not infer provider-specific SQL from the normalized runtime operation projection when the desired-state resource definition is the authoritative source.
Scope
For each supported generated collection resource, emit deterministic Supabase/Postgres migrations.
Minimum field mapping:
uuid->uuidtext/ canonical string type ->textnumber->numericboolean->booleandatetime->timestamptzjson->jsonbMinimum behavior:
required;unique;Explicit non-goals
Do not implement in this issue:
infra.backendcontract;manifest.data.apisreader;A future real HTTP/GraphQL generator requires a separately agreed package owner and implementation issue before any generator-adapter reference is added to canonical contracts.
Ownership
Required investigation
Before implementation:
manifest.data.apis,AppGeneratedApiDefinitionand old generated-dataset assumption;Tests
Cover at minimum:
not null;manifest.data.apiscompatibility path.Use representative generated resources such as products, captures, challenges or scan events only as test fixtures; do not couple Infra to those application domains.
Acceptance criteria
[adm 5].manifest.data.apisremains.ankhorage/studio#120.