definePublished in your schema.ts:
bijection/schema.ts
Producer and member
definePublished takes three fields:
producernames the pipeline that publishes this table. Every table with the same producer belongs to one group, and the whole group is published together.membernames this table’s place in the producer’s output. The pipeline’s output with the same name writes this table.rowis the document type, either an object of validators or av.objectvalidator.
_ or $, contain only
letters, digits, _ and $, and be at most 128 characters long. Two tables in
one schema cannot claim the same producer and member; deploying such a schema
is refused.
Bijection adds _id and _creationTime to every published row, as it does for
any table. See system fields.
Indexes and access rules
Declare indexes with.index(...) exactly as on an ordinary table, and read
through them with withIndex. See indexes.
You can also attach a read rule with .access(...). See
access rules.
Everything that would give the rows a second writer or a second derivation is
refused when the schema is evaluated:
A refused declaration throws an error such as:
Published tables are read-only
The generated data model marks a published table as not writable, so a write is a TypeScript error:bijection/orders.ts
ReadOnlyPublished, and a
data import cannot write one either. To
change what a published table holds, change its inputs or its pipeline and let
it publish again.
Adding and removing published tables
Deploying a schema that turns a table into a published table requires that table to be empty; a table that already holds rows is refused. Once a table is published, a later deployment cannot silently dropdefinePublished from it or
move it to another producer. Changing a group’s producer, its members or a
member’s row type requires an explicit
ownership transition.
Before the first publication
A published table is unavailable until its first publication succeeds. A query that reads it before then fails withPublishedUnavailable. The failed read
stays a dependency of the query, so a subscribed client receives the result as
soon as the table becomes available. See
Reading publications.