organization_provisioning_attempts Client SQLite table
Durable client-side provisioning handoff, keyed by the replacement source, native-restore scope, or (for ordinary creates) the generated organization id.
Declared in packages/client-sdk/src/data/sqlite/schema/organizationProvisioningAttemptSchema.ts
Description
The replacement request is intentionally retained until both remote provisioning and the organization-scoped local reset commit. A lost HTTP response or a failed local reset can therefore replay the exact signed artifacts instead of minting an incompatible second organization. Ordinary creates retain a user-and-input-scoped intent only until the local bootstrap commits, allowing a subsequent deliberate create with identical inputs. Greenfield storage: prechange attempts are not migrated.
Columns
replaced_organization_idtext- primary key
- not null
Attempt key: the id of the organization being replaced,
native-subscription-restore:<userId>for a native subscription restore, or the new organization's own id for an ordinary create.user_idtext- not null
User who started the attempt; another user's attempt is refused.
organization_idtext- not null
Id of the organization the attempt provisions.
root_container_idtext- not null
Id of the new organization's root container.
identity_bundle_formatinteger- not null
- default 1
Principal identity format of the stored artifacts. Rows keep the default
1; a backup restore refuses any other value as obsolete.serialized_artifactstext- not null
creation_intenttext- nullable
Canonical JSON of an ordinary create's inputs: the user id, base64 signing and encapsulation public keys, organization profile name, roster nickname, and provisioned system containers. Unique per user, so a retried identical create reuses this attempt. Null for replacements and native subscription restores.
created_attext- not null
ISO-8601 time the attempt was first stored.
Indexes
organization_provisioning_creation_intent_idx(user_id, creation_intent)- unique
DDL
The statements the client runs to create this table and its indexes.
CREATE TABLE IF NOT EXISTS "organization_provisioning_attempts" (
"replaced_organization_id" TEXT NOT NULL PRIMARY KEY,
"user_id" TEXT NOT NULL,
"organization_id" TEXT NOT NULL,
"root_container_id" TEXT NOT NULL,
"identity_bundle_format" INTEGER NOT NULL DEFAULT 1,
"serialized_artifacts" TEXT NOT NULL,
"creation_intent" TEXT,
"created_at" TEXT NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS "organization_provisioning_creation_intent_idx" ON "organization_provisioning_attempts" ("user_id", "creation_intent");