Skip to Content
DocsAPI ReferenceDatabase Schema

Database Schema

PostgreSQL on Supabase. All tables use UUID primary keys with gen_random_uuid(). Row Level Security (RLS) is enabled on all tables. Timestamps are timestamptz defaulting to now().

Current schema version: migration 059.


teams

Organizations/workspaces. Auto-created on user signup via handle_new_user() trigger.

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
nametextNoTeam name
suspended_attimestamptzYesNULLWhen set, team is suspended (read-only)
created_attimestamptzYesnow()Creation timestamp
updated_attimestamptzYesnow()Last update (auto-trigger)

RLS policies:

  • SELECT: Members of the team
  • INSERT: Anyone (auto-created on signup)
  • UPDATE: Owner or admin members

team_members

Team membership with role-based access.

ColumnTypeNullableDefaultDescription
team_iduuidNoFK -> teams.id (CASCADE)
user_iduuidNoFK -> auth.users.id (CASCADE)
roletextNo'member'owner, admin, or member
created_attimestamptzYesnow()Join timestamp

Primary key: (team_id, user_id)

Indexes: team_members_user_id_idx


scripts

Quantum script/template definitions. Both platform-seeded templates and user-uploaded scripts.

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
slugtextNoURL-friendly identifier
nametextNoDisplay name
descriptiontextYesDescription
categorytextNoCategory (e.g., Fundamentals, Chemistry)
qubitsintegerNo2Number of qubits
file_pathtextNoPath to script file (legacy)
script_contenttextYesInline Python source code
requirementstextYesrequirements.txt content
frameworktextYesqiskit, cirq, pennylane, openqasm, marqov
script_typetextYesworkflow or task
default_parametersjsonbYes{}Default execution parameters
estimated_cost_usdnumericYesEstimated cost
is_activebooleanYestrueSoft-delete flag
is_publicbooleanYesPublished status
user_iduuidYesFK -> auth.users.id (uploader)
team_iduuidYesFK -> teams.id (NULL = platform template)
created_attimestamptzYesnow()
updated_attimestamptzYesnow()Auto-trigger

Unique constraint: scripts_slug_framework_key (slug, framework) with NULLS NOT DISTINCT

RLS policies:

  • SELECT: Active scripts visible to all; users can see own scripts
  • INSERT: Users can create their own scripts (user_id = auth.uid())

job_runs

Quantum job execution records.

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
team_iduuidNoFK -> teams.id (CASCADE)
user_iduuidYesFK -> auth.users.id (SET NULL)
script_iduuidYesFK -> scripts.id (SET NULL)
inline_codetextYesCode snapshot from playground
frameworktextYesQuantum framework
statustextNo'pending'pending, queued, running, completed, failed, cancelled
backendtextNo'local'Backend slug
parametersjsonbYes{}Execution parameters
execution_modetextYes'direct'direct or temporal
workflow_idtextYesTemporal workflow ID
temporal_run_idtextYesTemporal run ID
temporal_statustextYesTemporal workflow status
workflow_metadatajsonbYesTask graph, timeline, per-task timing
braket_task_arnstext[]YesAWS Braket task ARNs
started_attimestamptzYesExecution start time
completed_attimestamptzYesCompletion time
wall_time_secondsnumericYesTotal wall clock time
quantum_time_secondsnumericYesQPU time only
estimated_cost_usdnumericYesEstimated cost
actual_cost_usdnumericYesActual cost
error_messagetextYesError message (if failed)
error_detailsjsonbYesDetailed error info
create_capsulebooleanYesfalseWhether to create a capsule
capsule_nametextYesCapsule name
created_attimestamptzYesnow()
updated_attimestamptzYesnow()Auto-trigger

Constraint: job_runs_has_code: script_id IS NOT NULL OR inline_code IS NOT NULL

Indexes: team_id, user_id, status, workflow_id, created_at DESC

Realtime: Enabled (supabase_realtime)


job_results

Individual result records from job executions.

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
job_run_iduuidNoFK -> job_runs.id (CASCADE)
result_typetextNoType of result
result_datajsonbNoResult payload
quantum_time_secondsnumericYesQPU time
shotsintegerYesShots executed
created_attimestamptzYesnow()

backends

Available quantum backends with pricing and metadata.

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
slugtextNoUnique URL-friendly ID (e.g., sv1)
nametextNoDisplay name
providertextNoProvider (e.g., AWS Braket, IonQ)
device_typetextNosimulator or qpu
device_arntextNoUnique provider device ARN
provider_target_idtextYesProvider-specific target ID
regiontextYesAWS region
qubit_countintegerYesNumber of qubits
topologytextYesConnectivity (e.g., all-to-all)
is_availablebooleanYestrueAccepting jobs
statustextYes'online'online, offline, maintenance
pricingjsonbYes{ taskFee, perShot, minimumCost }
max_shotsintegerYes100000Maximum shots
max_qubitsintegerYesMaximum qubits
descriptiontextYesDescription
documentation_urltextYesProvider docs URL
tagstext[]YesSearchable tags
display_orderintegerYes0UI sort order
is_recommendedbooleanYesfalseFeatured backend
created_attimestamptzYesnow()
updated_attimestamptzYesnow()Auto-trigger

RLS: SELECT only where is_available = true. No public INSERT/UPDATE/DELETE (managed via SQL Editor).

Seeded backends: sv1, dm1, tn1, ionq-aria-1, ionq-aria-2, ionq-forte-1, rigetti-ankaa-2, rigetti-ankaa-3, iqm-garnet, iqm-emerald, quera-aquila.


capsules

Reproducible workflow packages for quantum-classical workflows.

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
team_iduuidNoFK -> teams.id (CASCADE)
user_iduuidYesFK -> auth.users.id (SET NULL)
nametextNoCapsule name
descriptiontextYesDescription
versiontextNo'1.0.0'Schema version
lifecycle_statetextNo'draft'draft, runnable, sealed, archived
job_iduuidYesFK -> job_runs.id (SET NULL)
run_iduuidNogen_random_uuid()Unique run identifier
git_shatextYesSource commit SHA
git_repotextYesSource repository URL
parent_capsule_iduuidYesFK -> capsules.id (SET NULL)
custom_metadatajsonbYes{}Tags, budget, retention, backends
started_attimestamptzYesExecution start
completed_attimestamptzYesExecution end
wall_time_secondsnumericYesTotal wall time
num_tasksintegerYes0Task count
total_shotsintegerYes0Total shots
max_budget_usdnumericYesBudget cap
estimated_cost_usdnumericYesEstimated cost
actual_cost_usdnumericYes0Actual cost
cost_breakdownjsonbYes[]Per-task cost details
digestsjsonbYesSHA256 hashes for verification
regulatory_frameworktextYese.g., FDA-21CFR11
retention_yearsintegerYesData retention period
doitextYesDigital Object Identifier
sealed_attimestamptzYesSeal timestamp
sealed_byuuidYesFK -> auth.users.id
created_attimestamptzYesnow()
updated_attimestamptzYesnow()Auto-trigger

Lifecycle: draft -> runnable -> sealed -> archived. Sealed capsules are immutable.

Indexes: team_id, user_id, job_id, lifecycle_state, created_at DESC, run_id, full-text search on name + description.

Realtime: Enabled.


capsule_artifacts

File artifacts associated with capsules.

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
capsule_iduuidNoFK -> capsules.id (CASCADE)
nametextNoFilename (e.g., workflow.json)
artifact_typetextNoworkflow, environment, backends, data, results, provenance, other
storage_pathtextYesS3 path
content_typetextYesMIME type
size_bytesbigintYesFile size
digesttextYesSHA256 hash (sha256:HEX)
content_texttextYesInline content (YAML/JSON)
content_binarybyteaYesBinary content
created_attimestamptzYesnow()

capsule_task_executions

Individual task executions within a capsule workflow.

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
capsule_iduuidNoFK -> capsules.id (CASCADE)
task_idtextNoTask identifier
backendtextNoBackend slug
start_timetimestamptzYesStart time
end_timetimestamptzYesEnd time
wall_time_secondsnumericYesDuration
queue_time_secondsnumericYes0Queue wait time
cost_usdnumericYes0Task cost
shotsintegerYesShots executed
job_idtextYesBackend job ID
qpu_calibrationjsonbYesQPU calibration snapshot
outputs_digesttextYesSHA256 of outputs
created_attimestamptzYesnow()

team_secrets

Encrypted team-scoped provider credentials.

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
team_iduuidNoFK -> teams.id
providertextNoProvider name
key_nametextNoSecret key name
encrypted_valuetextNoEncrypted secret value
descriptiontextYesDescription
is_activebooleanYestrueActive flag
validation_statustextYesLast validation result
last_validated_attimestamptzYesLast validation time
validation_errortextYesValidation error message
last_used_attimestamptzYesLast usage time
created_attimestamptzYesnow()
updated_attimestamptzYesnow()

Upsert function: upsert_team_secret(p_team_id, p_provider, p_key_name, p_value, p_created_by) — encrypts value server-side.


team_invitations

Pending team invitations.

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
team_iduuidNoFK -> teams.id
emailtextNoInvitee email
roletextNoadmin or member
tokentextNoSecure invitation token (64 hex chars)
invited_byuuidNoFK -> auth.users.id
statustextNo'pending'pending, accepted, expired, revoked
expires_attimestamptzNoExpiration (7 days from creation)
created_attimestamptzYesnow()

simulation_events

Browser simulation telemetry.

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
user_iduuidNoFK -> auth.users.id
team_iduuidNoFK -> teams.id
session_idtextNoClient session ID
simulatortextNoquantum-circuit or qulacs-wasm
qasm_inputtextNoQASM input
shotsintegerNoShots executed
qubit_countintegerNoNumber of qubits
gate_countintegerNoNumber of gates
execution_time_msrealNoExecution time in ms
countsjsonbNo{}Measurement counts
source_frameworktextYesSource framework
user_agenttextYesBrowser user agent
created_attimestamptzNonow()

RLS: Users can INSERT and SELECT their own events. Service role can SELECT all.


benchmark_suites

Benchmark suite definitions (created from migration 010).

ColumnTypeDescription
iduuidPrimary key
team_iduuidFK -> teams.id
user_iduuidFK -> auth.users.id
nametextSuite name
descriptiontextDescription
statustextpending, running, completed, failed
tagstext[]Searchable tags
created_attimestamptz
updated_attimestamptz

Key Relationships

auth.users |-- team_members (user_id) |-- job_runs (user_id) |-- capsules (user_id, sealed_by) |-- scripts (user_id) |-- simulation_events (user_id) teams |-- team_members (team_id) |-- job_runs (team_id) |-- capsules (team_id) |-- team_secrets (team_id) |-- team_invitations (team_id) |-- webhook_endpoints (team_id) scripts |-- job_runs (script_id) job_runs |-- job_results (job_run_id) |-- capsules (job_id) capsules |-- capsule_artifacts (capsule_id) |-- capsule_task_executions (capsule_id) |-- capsules (parent_capsule_id, self-referential)

Migration History (Key Migrations)

#FileDescription
001001_initial_schema.sqlCore tables: teams, team_members, scripts, job_runs, job_results, webhooks, RLS
006006_create_backends_table.sqlBackends table with seeded devices
010010_benchmark_suites.sqlBenchmark suites
012012_capsules.sqlCapsules, artifacts, task executions
014014_invitation_codes.sqlInvitation code system
042042_create_providers_table.sqlProviders table
045045_add_cost_tracking.sqlCost tracking
047047_team_suspension.sqlTeam suspension (suspended_at)
048048_security_hardening_rls.sqlRLS security hardening
050050_simulation_events.sqlBrowser simulation telemetry
051051_template_migration_schema.sqlFramework column on scripts, execution_mode on job_runs
054054_inline_code_on_job_runs.sqlInline code + framework on job_runs
056056_add_marqov_simulator_backend.sqlMarqov branded simulator
058058_add_workflow_metadata_column.sqlWorkflow metadata on job_runs
059059_add_quantum_brilliance_backends.sqlQuantum Brilliance backends
Last updated on