@protobase/cli 0.133.4 → 0.133.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.133.
|
|
3
|
+
"version": "0.133.6",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@better-auth/core": "^1.7.12",
|
|
45
45
|
"@hono/node-server": "^2.1.3",
|
|
46
|
-
"@protobase/config": "0.133.
|
|
47
|
-
"@protobase/layout": "0.133.
|
|
48
|
-
"@protobase/query": "0.133.
|
|
49
|
-
"@protobase/schema": "0.133.
|
|
50
|
-
"@protobase/server": "0.133.
|
|
51
|
-
"@protobase/ui": "0.133.
|
|
52
|
-
"@protobase/workflows": "0.133.
|
|
46
|
+
"@protobase/config": "0.133.6",
|
|
47
|
+
"@protobase/layout": "0.133.6",
|
|
48
|
+
"@protobase/query": "0.133.6",
|
|
49
|
+
"@protobase/schema": "0.133.6",
|
|
50
|
+
"@protobase/server": "0.133.6",
|
|
51
|
+
"@protobase/ui": "0.133.6",
|
|
52
|
+
"@protobase/workflows": "0.133.6",
|
|
53
53
|
"@react-email/render": "^2.1.0",
|
|
54
54
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
55
55
|
"@sentry/vite-plugin": "^11.10.0",
|
|
@@ -687,7 +687,7 @@ Writes what the config and this version of Protobase need beyond the project's `
|
|
|
687
687
|
|
|
688
688
|
A sign-in module the config turns off is [kept](auth.md#turning-a-module-off): on a terminal it asks what becomes of its tables, keep, archive or delete, keep being the default, and without one it needs `--off`. Archive and delete keep it as keep does until [`contract`](#signing-off-an-update) signs the update off. A kept module turned on again goes on from its step; with `DATABASE_URL` set and rows in its tables, it asks on a terminal whether to bring them back, and needs `--force` without one, and the file it writes then applies with `protobase migrate --force`.
|
|
689
689
|
|
|
690
|
-
The snapshot describes the schema the project's migrations make: the sign-in store as the runtime reads it, each module that is on with its tables, columns and indexes under the names the config gives them, its last step, and whether every table whose rows belong to an organization has the column that names it, with `modelHash`, the SHA-256 of exactly that; what the migrations decided, the file it ends at with its id, its `format` and the version of Protobase that wrote it, the modules kept or archived, whether organizations were ever on and the default organization, and in `external` the store's relations Protobase did not make, such as the user view of [`users.keyTable`](auth.md#a-view-over-another-systems-users), which no step alters; and `physical`, every schema, table, column and index name the store has. Its `model.modules` holds each built-in schema, each a module with numbered steps, such as the [jobs schema](jobs.md#the-jobs-schema) (`jobs`), the [change capture](events.md#migrations-and-startup) (`changes`) and its [history](history.md#the-table) and [notices](live.md#the-table) tables (`history`, `notices`), the [webhook subscriptions](webhooks.md#subscriptions-in-the-admin-app) of `webhooks` (`webhooks`) and their delivery log with `deliveryLog` (`webhook_delivery_log`), the [workflows, versions and runs](workflows.md#turning-them-on) of `workflows` (`workflows`) with their storage configurations and custom steps while those are on (`workflow_storage`, `workflow_custom_steps`), the [devices and history tables](notifications.md#table-names) of `notifications` (`notification_devices`, `notification_history`), each unless a store of the app's own replaces it, the [comments table](comments.md#the-table) (`comments`), the table of the bounces and complaints of [`mailFeedback`](email.md#bounces-and-complaints) (`mail_feedback`), written before the change capture whose triggers capture its events, and the table of who unsubscribed from bulk mail of [`unsubscribe`](email.md#unsubscribe) (`unsubscribes`), and the [query role](assistant.md#the-built-in-backend) of read-only queries (`query`), each at its last step and the version of the functions over it, with the names it takes from the config, such as the schema `events`, `webhooks.schema` or `workflows.schema` names, the notifications tables' names and columns and the users table they point at, and the triggers of each captured resource at a digest of their statements; it keeps one the config no longer needs as the migrations left it. That part of the file comes from the snapshot alone too, after the store's: the module's steps after its last one, then its functions where the snapshot has another version, then the triggers of each resource whose statements differ, such as one added or one whose field became sensitive; a file that replaces them with a version the code before does not run on says `-- protobase:breaks-older-code`. A name the config changes, such as `events.schema`, `webhooks.schema` or a notifications table's column, is refused, since Protobase does not write renames; so is turning sign-in on under notifications tables made without it, whose user column then points at no users table. With `DATABASE_URL` set, it refuses to write a module from its first step onto a database that has it already, as made by an earlier version's migration, and names `baseline`. The sign-in store's part of the file comes from the snapshot alone, without a database: the [steps](auth.md#migrations) after each module's last one, those a newer Protobase ships included, each followed by its row in `auth_steps`; a snapshot whose store has no `auth_steps` yet, as a Protobase before 0.130 wrote it, is refused
|
|
690
|
+
The snapshot describes the schema the project's migrations make: the sign-in store as the runtime reads it, each module that is on with its tables, columns and indexes under the names the config gives them, its last step, and whether every table whose rows belong to an organization has the column that names it, with `modelHash`, the SHA-256 of exactly that; what the migrations decided, the file it ends at with its id, its `format` and the version of Protobase that wrote it, the modules kept or archived, whether organizations were ever on and the default organization, and in `external` the store's relations Protobase did not make, such as the user view of [`users.keyTable`](auth.md#a-view-over-another-systems-users), which no step alters; and `physical`, every schema, table, column and index name the store has. Its `model.modules` holds each built-in schema, each a module with numbered steps, such as the [jobs schema](jobs.md#the-jobs-schema) (`jobs`), the [change capture](events.md#migrations-and-startup) (`changes`) and its [history](history.md#the-table) and [notices](live.md#the-table) tables (`history`, `notices`), the [webhook subscriptions](webhooks.md#subscriptions-in-the-admin-app) of `webhooks` (`webhooks`) and their delivery log with `deliveryLog` (`webhook_delivery_log`), the [workflows, versions and runs](workflows.md#turning-them-on) of `workflows` (`workflows`) with their storage configurations and custom steps while those are on (`workflow_storage`, `workflow_custom_steps`), the [devices and history tables](notifications.md#table-names) of `notifications` (`notification_devices`, `notification_history`), each unless a store of the app's own replaces it, the [comments table](comments.md#the-table) (`comments`), the table of the bounces and complaints of [`mailFeedback`](email.md#bounces-and-complaints) (`mail_feedback`), written before the change capture whose triggers capture its events, and the table of who unsubscribed from bulk mail of [`unsubscribe`](email.md#unsubscribe) (`unsubscribes`), and the [query role](assistant.md#the-built-in-backend) of read-only queries (`query`), each at its last step and the version of the functions over it, with the names it takes from the config, such as the schema `events`, `webhooks.schema` or `workflows.schema` names, the notifications tables' names and columns and the users table they point at, and the triggers of each captured resource at a digest of their statements; it keeps one the config no longer needs as the migrations left it. That part of the file comes from the snapshot alone too, after the store's: the module's steps after its last one, then its functions where the snapshot has another version, then the triggers of each resource whose statements differ, such as one added or one whose field became sensitive; a file that replaces them with a version the code before does not run on says `-- protobase:breaks-older-code`. A name the config changes, such as `events.schema`, `webhooks.schema` or a notifications table's column, is refused, since Protobase does not write renames; so is turning sign-in on under notifications tables made without it, whose user column then points at no users table. With `DATABASE_URL` set, it refuses to write a module from its first step onto a database that has it already, as made by an earlier version's migration, and names `baseline`. The sign-in store's part of the file comes from the snapshot alone, without a database: the [steps](auth.md#migrations) after each module's last one, those a newer Protobase ships included, each followed by its row in `auth_steps`; a snapshot whose store has no `auth_steps` yet, as a Protobase before 0.130 wrote it, is refused. Each runs only while `auth_steps` lacks it, so a database that has it already, such as one [`migrate-release`](#release-steps) brought to a newer release, skips it. With `DATABASE_URL` set, the checks of those steps run first against the database's rows, in a read-only transaction, and refuse as the step would, such as on two accounts with one provider and account id. A name the store has that the config changes, such as a table renamed in [`auth.tables`](auth.md#table-and-column-names), is refused with what changed, since Protobase does not write renames: write it by hand with `--custom` and `--record-config`. A store a newer Protobase describes otherwise with no step to apply, such as personal access tokens now holding an organization's rows, gets a file that records it anew and changes nothing in the database. A step whose work cannot run in a transaction leaves it to the file's `.after.sql`, such as the batches that give each personal access token the [default organization](auth.md#the-default-organization) when organizations turn on, and the index it builds concurrently. With organizations on or ever on, the file needs `organizations.default` in the config, and turning them on the first time over a store that may hold users needs `organizations.existingUsersRole`; it refuses without them, as `migration check` reports.
|
|
691
691
|
|
|
692
692
|
The rest of the file is what the config still needs of the database, compared with it, under its own comment and named in the file name as in brackets: with [`userTables`](user-tables.md#the-switch), the delete of the definitions of tables that resources in code [own now](user-tables.md#taking-a-table-over-as-code) (`owned_definitions`). It is compared only with `DATABASE_URL` set, against the database with the project's migrations applied, and the command says so without it. The jobs schema is written when the config has jobs, `webhooks`, `workflows`, `notifications` or `mailFeedback`, or uses the relay, or a resource has events, history, comments or an [AI field](ai.md) or is a [time rollup](data-config.md#keeping-it-up-to-date). The rollups and formulas module is written when a resource has [rollup or formula fields](data-config.md#rollups-and-formulas) or is a [time rollup](data-config.md#time-rollups) (`computed`): the `rollups` schema, then per field and rollup the columns, the functions and triggers that keep the rollups, and the tables, indexes and refresh functions of time rollups; a changed one is dropped and made again, and what sets a rollup's values or fills a time rollup goes in the file's `.after.sql`, which runs once its transaction commits. The `derived` schema is written when a resource has [derived values](derived.md), with each value declared and its fill enqueued, and a value no longer declared loses its state. The schemas of user tables (`user_tables`) are written with [`userTables`](user-tables.md#the-switch); the tables users add inside them are data, made while the app serves. The change capture is written when a resource has events, history, live updates or derived values, another's derived values or live updates read it, or `mailFeedback` is on; its history table with history, and its notices table with live updates. The webhooks, workflows, notifications, [status](status.md), [calls](calls.md), comments, mail feedback and unsubscribe modules, the `realtime_relay` schema of [`realtime: { processes: 'many' }`](supabase-realtime.md#several-processes) and the `channels` schema of [`realtime: { sqlSends: true }`](channels.md#from-sql) are written while the config turns their feature on, and none of them while it is off; turning a feature off later leaves its tables as they are. Calls write the notices table too, which rings reach open pages through. The [relay](realtime-relay.md#sessions) module, the trigger that ends a deleted session's sockets and `realtime.members` with the triggers that keep it from channel records that list their members, is written with `realtime.relay`, and for an app with sign-in and a live resource whose conversation page has `members`, after the auth store's steps, since its trigger is on the sessions table. The query module, the role the [assistant's read-only queries](assistant.md#the-built-in-backend) and those of [`mcpEndpoint.sql`](mcp.md#sql-for-admins) run as with the function they run through, is written last when the command finds the built-in assistant's key or `mcpEndpoint.sql` is on (`query`), with the role's grants on each resource's table but those of the auth store: a resource added writes only its grants, and one removed takes them back. It reads the config merged with those of `--extend` as `dev` merges them, and the `.env` nearest the current directory.
|
|
693
693
|
|
|
@@ -697,7 +697,7 @@ Every file is additive, so the code still running while it deploys, and the vers
|
|
|
697
697
|
|
|
698
698
|
- `--custom <name>` writes an empty numbered file, `NNN_<name>.sql`, with Protobase's lines and `-- protobase:custom`, for statements you write by hand, and makes the snapshot end at it. Say what it is among its `-- protobase:` lines, which `check` requires: `-- protobase:additive` once it only adds, which `check` verifies with Postgres's own parser, statement by statement, passing only what adds, such as a new table (not `if not exists`, which may find one with rows), a nullable or defaulted column, a plain index, a constraint or unique index on a table the file makes, a new enum value, a trigger dropped and made again on its table, and `create or replace` of a view or function, which Postgres refuses when its columns, arguments or result change; a dropped default, a renamed enum value and a `delete` inside an `insert` or `update` count as taking from older code; or `-- protobase:breaks-older-code` when it takes from older code what it reads, such as a rename or a dropped column. Either way `migrate` records it as not additive unless it says `-- protobase:additive`. Write the statements above the statement that records it, which stays last; `migrate` fills in its hash and whether it is marked additive from the finished file. With `--record-config`, the snapshot takes the sign-in store's names as the config has them now, each module at the step it was: the file is where you make the store match, such as a rename, and it says `-- protobase:breaks-older-code`. With `--after`, it also writes an empty `NNN_<name>.after.sql` beside it, for statements that cannot run in a transaction, such as `create index concurrently if not exists`, which `migrate` runs once the file commits (see [The record of migrations](../guides/deploy.md#the-record-of-migrations)).
|
|
699
699
|
- `check`, for CI, writes nothing and exits 1 with a line for each problem: a config or Protobase version that needs steps the migrations lack, of the sign-in store or a schema module, or a schema module the snapshot does not record at all, a name the config changed, two files that share a number when Protobase wrote one of them, a snapshot that does not end at the newest file Protobase wrote or whose model does not match its `modelHash`, a hand-written file that says neither `-- protobase:additive` nor `-- protobase:breaks-older-code`, says both, has a statement marked `-- protobase:contract`, which only Protobase writes, or is marked additive while a statement does not only add, and a `-- protobase:contract <id>` that names no file before its own. It also prints a `warning:` line, which leaves the exit code alone, for each statement the `squawk-cli` linter finds that holds a lock blocking reads while it scans or rewrites a table, such as `set not null` or a column type change, and for each statement of a file Protobase wrote that takes from older code without `-- protobase:contract`, such as a formula's column made again.
|
|
700
|
-
- `baseline` describes, once, what the project's earlier migrations made that the snapshot does not record: each schema module the config needs, such as a jobs schema an earlier version's `protobase migration` wrote, read from its catalogue as the step pg-boss's version is at and the version Protobase's functions carry, and refused at a pg-boss version no step records, or a change capture, read as its first step once the outbox is there, `capture()` at its version when its body is the one this version writes, and each resource whose table has triggers calling it, which the next `protobase migration` writes again when they are not the ones the config makes, and refused for an outbox without its `database_role` column or a history table without its indexes, or the rollups and formulas, read as their first step once the `rollups` schema is there, and each rollup's column, formula's column, rollup's function and trigger, and time rollup's table and refresh function found, current when it is what this or, for a rollup or formula, an earlier version made of the config, else made again by the next `protobase migration`, as a time rollup an earlier version made is, and refused where the column or table is the project's own or a rollup's column is of another type, or the `derived` schema, read as its first step once its tables, sequence and indexes are there, with each value `derived.declared` marks, and refused without the sequence, the pending table or their indexes, or the schemas of user tables, read as their first step once every part is there, and refused for a definitions table made before organizations, or the tables of webhooks, workflows and notifications, each read as its first step once its tables are there with every index and, for a devices or history table of the app's own, each column under its configured name and the foreign key to the users, the webhooks' functions at the version their comments carry and the workflows' at version 28, the statuses table read as its first step once it has its columns and the foreign key to the users, the calls schema as its first step once its tables are there and its second once its guest tables are too, the `realtime_relay` and `channels` schemas as their first step once their tables are there, `channels.send()` too, the comments, mail feedback and opt-outs tables as their first step once each is there with every index, the query role as its first step once it and the `query` schema are there, with its function at version 1 when it is the one this version writes, owned by the role and not executable by everyone, each resource whose table it reads, and each table it reads that no resource has, which the next `protobase migration` takes back, and the relay's trigger and `realtime.members` functions at their versions with each listed channel whose triggers are the ones this version writes, enabled on its table and its partitions, else written again by the next `protobase migration`, and refused at an older version or shape no step records, such as webhooks without the indexes their version 2 added, a devices table without its session column, a feedback table whose recipient a complaint cannot leave out, or `realtime.members` functions before their version 3; in a project without a snapshot, the sign-in store too. It writes `NNN_baseline.sql`, which changes nothing and records itself, and the snapshot with them, after which `protobase migration` writes only what they lack. For the sign-in store, it starts the snapshot of a project whose store came from auth migrations written before it, such as an app's existing `db/migrations/*_auth.sql`, once: run it with `DATABASE_URL` pointing at the database with those migrations applied. In one read-only transaction it reads the steps the store records in `auth_steps` and the tables of the store's schema, and writes `NNN_baseline.sql`, which changes nothing and records itself in `migrations.history`, and `protobase.snapshot.json` describing the store as it is: each module the config has on at the step it records; a module that is off but has tables as kept; organizations as ever on when a table whose rows belong to an organization, such as `member`, has the column that names it; and the user table as external when the config reads it through [`users.keyTable`](auth.md#a-view-over-another-systems-users), so no step writes to it; a user table the database has as a view needs `users.keyTable`, naming the table that holds the user ids, and is refused without it. `auth_migrations` stays as it is, read no more. Apply the file with the project's other migrations, then run `protobase migration`, which writes only the steps the store lacks, and nothing for a current store. It refuses a project whose snapshot records every schema module the database has, a store that records versions in `auth_migrations` without `auth_steps`, which
|
|
700
|
+
- `baseline` describes, once, what the project's earlier migrations made that the snapshot does not record: each schema module the config needs, such as a jobs schema an earlier version's `protobase migration` wrote, read from its catalogue as the step pg-boss's version is at and the version Protobase's functions carry, and refused at a pg-boss version no step records, or a change capture, read as its first step once the outbox is there, `capture()` at its version when its body is the one this version writes, and each resource whose table has triggers calling it, which the next `protobase migration` writes again when they are not the ones the config makes, and refused for an outbox without its `database_role` column or a history table without its indexes, or the rollups and formulas, read as their first step once the `rollups` schema is there, and each rollup's column, formula's column, rollup's function and trigger, and time rollup's table and refresh function found, current when it is what this or, for a rollup or formula, an earlier version made of the config, else made again by the next `protobase migration`, as a time rollup an earlier version made is, and refused where the column or table is the project's own or a rollup's column is of another type, or the `derived` schema, read as its first step once its tables, sequence and indexes are there, with each value `derived.declared` marks, and refused without the sequence, the pending table or their indexes, or the schemas of user tables, read as their first step once every part is there, and refused for a definitions table made before organizations, or the tables of webhooks, workflows and notifications, each read as its first step once its tables are there with every index and, for a devices or history table of the app's own, each column under its configured name and the foreign key to the users, the webhooks' functions at the version their comments carry and the workflows' at version 28, the statuses table read as its first step once it has its columns and the foreign key to the users, the calls schema as its first step once its tables are there and its second once its guest tables are too, the `realtime_relay` and `channels` schemas as their first step once their tables are there, `channels.send()` too, the comments, mail feedback and opt-outs tables as their first step once each is there with every index, the query role as its first step once it and the `query` schema are there, with its function at version 1 when it is the one this version writes, owned by the role and not executable by everyone, each resource whose table it reads, and each table it reads that no resource has, which the next `protobase migration` takes back, and the relay's trigger and `realtime.members` functions at their versions with each listed channel whose triggers are the ones this version writes, enabled on its table and its partitions, else written again by the next `protobase migration`, and refused at an older version or shape no step records, such as webhooks without the indexes their version 2 added, a devices table without its session column, a feedback table whose recipient a complaint cannot leave out, or `realtime.members` functions before their version 3; in a project without a snapshot, the sign-in store too. It writes `NNN_baseline.sql`, which changes nothing and records itself, and the snapshot with them, after which `protobase migration` writes only what they lack. For the sign-in store, it starts the snapshot of a project whose store came from auth migrations written before it, such as an app's existing `db/migrations/*_auth.sql`, once: run it with `DATABASE_URL` pointing at the database with those migrations applied. In one read-only transaction it reads the steps the store records in `auth_steps` and the tables of the store's schema, and writes `NNN_baseline.sql`, which changes nothing and records itself in `migrations.history`, and `protobase.snapshot.json` describing the store as it is: each module the config has on at the step it records; a module that is off but has tables as kept; organizations as ever on when a table whose rows belong to an organization, such as `member`, has the column that names it; and the user table as external when the config reads it through [`users.keyTable`](auth.md#a-view-over-another-systems-users), so no step writes to it; a user table the database has as a view needs `users.keyTable`, naming the table that holds the user ids, and is refused without it. `auth_migrations` stays as it is, read no more. Apply the file with the project's other migrations, then run `protobase migration`, which writes only the steps the store lacks, and nothing for a current store. It refuses a project whose snapshot records every schema module the database has, a store that records versions in `auth_migrations` without `auth_steps`, which no step of this version reads, a store without either record, one made before 0.48, which [`auth migration`](#auth-migration) adopts first, a version this Protobase does not ship, and a table a recorded step made that the schema lacks under the name the config gives it, such as one renamed since, naming each. <gap>`baseline` cannot refuse a column renamed since a step made it because recording which columns each step adds is not implemented.</gap> The first `protobase migration` after it keeps the organization of each personal access token that has one, and refuses one without, naming it, rather than give it the [default organization](auth.md#the-default-organization): no other column says where a token works.
|
|
701
701
|
- `drop` deletes the newest file Protobase wrote and takes the snapshot back to the one before it, from that file's lines, or removes the snapshot with the first file. It refuses while two files share a number or the snapshot does not end at the newest file, so it never deletes another branch's file, and after a file that recorded a changed config, or one `contract` or `delete` wrote, whose snapshot before it only version control has.
|
|
702
702
|
- `up` rewrites the snapshot in this version's format. Every other command refuses a snapshot of an older format, and one of a newer format, which only a newer Protobase reads.
|
|
703
703
|
|
|
@@ -738,7 +738,7 @@ Prints the app's entry for the apps file of [Realtime](realtime-relay.md), as JS
|
|
|
738
738
|
protobase auth migration [--dir db/migrations] [--name auth]
|
|
739
739
|
```
|
|
740
740
|
|
|
741
|
-
Run inside a project, against its database with the project's migrations applied. It reads the steps the store applied from its `auth_steps` table, refusing a store that records versions in `auth_migrations` without it, which
|
|
741
|
+
Run inside a project, against its database with the project's migrations applied. It reads the steps the store applied from its `auth_steps` table, refusing a store that records versions in `auth_migrations` without it, which no step of this version reads, and writes the steps of the modules the config has on that it has not, each followed by its row there, as the next migration in `--dir`: `009_auth.sql` after `008_...`, with the store's schema, user table, columns and id type as the config's `auth` names them. Nothing is written when the store is current and the project has a snapshot, nor with sign-in off, when it says so and exits 0. The file only adds, and drops nothing but `auth_migrations`, the record of versions `auth_steps` replaced; apply it with the project's other migrations. It starts with Protobase's lines, ends with the statement that records it in `migrations.history`, and starts the project's `protobase.snapshot.json`, or moves it on, with the store at every step, so [`migration`](#migration) goes on from it. A project without a snapshot whose store is current, such as one whose auth migrations an earlier Protobase wrote, gets a file without statements that starts it, and one whose store is current but not in `migrations.history`, such as one migrated before that record, a file that only records it. For a store made before 0.48, with neither record, it writes the step that adopts it once, and refuses one that matches no version, naming what differs. See [migrations](auth.md#migrations).
|
|
742
742
|
|
|
743
743
|
## `import supabase`
|
|
744
744
|
|
|
@@ -102,6 +102,10 @@ export default defineConfig({ events: { schema: 'row_changes' } })
|
|
|
102
102
|
|
|
103
103
|
## What the write-ahead log carries
|
|
104
104
|
|
|
105
|
+
:::caution[In development]
|
|
106
|
+
The messages are written, but Protobase itself does not read them yet: live updates and events still go through [the outbox](#the-outbox).
|
|
107
|
+
:::
|
|
108
|
+
|
|
105
109
|
A reader of the database's write-ahead log (WAL), such as a logical replication client, can name each changed row's resource and who changed it without any table of Protobase's: Protobase writes it there as logical decoding messages, transactional ones, so each arrives with its transaction's rows, in their order, and only once it commits.
|
|
106
110
|
|
|
107
111
|
- **`protobase_actor`**: the API emits it at the start of every write transaction it runs for a caller, a single write, a batch, a comment, a write through the [PostgREST-compatible API](supabase-rest.md) or the storage API, in the same statement that sets the transaction's settings, so it costs no round trip. Its content is the caller as `changes.actor` holds it, such as `{"id":"u1","roles":["admin"]}`; the PostgREST-compatible and storage APIs name their signed-in user only, with no roles, and emit none for an anonymous caller or the app's own key. A write of the app's own background work, or from outside the API, has no `protobase_actor` message.
|
|
@@ -441,7 +441,7 @@ The default store keeps devices in the table `devices` of the schema `notificati
|
|
|
441
441
|
| `session_id` | the id of the sign-in session it was registered in, never its token; `NULL` when the app's `authenticate` names none |
|
|
442
442
|
| `created_at`, `last_seen_at` | when the user registered it, and last refreshed it |
|
|
443
443
|
|
|
444
|
-
[`protobase migration baseline`](cli.md#migration) refuses a devices table written before devices kept their session or could be relay devices
|
|
444
|
+
[`protobase migration baseline`](cli.md#migration) refuses a devices table written before devices kept their session or could be relay devices, which no step of this version of Protobase records.
|
|
445
445
|
|
|
446
446
|
You rename the schema, the table and each column, as auth takes `tables`, such as to keep devices in a table you already have:
|
|
447
447
|
|