Vintner

Database Schema

Complete PostgreSQL schema reference — tables, enums, functions, and Realtime subscriptions.

Database Schema

The platform uses Supabase PostgreSQL as its sole database. All tables are protected by Row Level Security (RLS). Real-time features are powered by Supabase Realtime subscriptions on specific tables.

Database Schema

Core Tables

vineyards

Workspace grouping for infrastructure configurations.

ColumnTypeDescription
iduuid (PK)
user_iduuid (FK → auth.users)Owner
nametextUnique per user
descriptiontextOptional
created_attimestamptz
updated_attimestamptz

Constraint: UNIQUE(user_id, name)

vines

Infrastructure configuration — the central entity.

ColumnTypeDescription
iduuid (PK)
user_iduuid (FK)Owner
vineyard_iduuid (FK → vineyards)Parent vineyard
cloud_identity_iduuid (FK → cloud_identities)Cloud account to provision in
project_nametextInfrastructure project name
environment_stageenvironment_stage enumdevelopment / staging / production
regiontextCloud region (e.g., eu-west-1)
terraform_versiontextDefault: 1.11.4
statusvine_status enumDRAFT → ACTIVE → DESTROYED
estimated_monthly_costnumericCalculated cost estimate
created_attimestamptz
updated_attimestamptz

cloud_identities

Cloud provider connections (AWS, GCP, Azure).

ColumnTypeDescription
iduuid (PK)
user_iduuid (FK)Owner
providertextaws / gcp / azure
nametextDisplay name
credentialsjsonbProvider-specific (role ARN, external ID, WIF config, etc.)
is_verifiedbooleanPassed connection test
created_attimestamptz
updated_attimestamptz

provider_tokens

OAuth tokens for Git providers.

ColumnTypeDescription
iduuid (PK)
user_iduuid (FK)Owner
providertextgithub / gitlab / bitbucket
access_tokentextEncrypted at rest
refresh_tokentextEncrypted at rest
expires_attimestamptzToken expiry

Vine Component Tables (Singleton — 1:1 per Vine)

vine_network

VPC / VNet / VPC Network configuration.

ColumnTypeDescription
iduuid (PK)
vine_iduuid (UNIQUE FK)
provision_networkbooleanCreate new or use existing
network_idtextExisting network ID (if not provisioning)
cidr_blocktexte.g., 10.0.0.0/16
single_nat_gatewaybooleanCost optimization
allowed_cidr_blockstext[]Allowed CIDR ranges
statuscomponent_status enum
estimated_monthly_costnumeric

vine_cluster

EKS / GKE / AKS configuration.

ColumnTypeDescription
iduuid (PK)
vine_iduuid (UNIQUE FK)
cluster_versiontexte.g., 1.31
provider_configjsonbProvider-specific overrides
cluster_adminsjsonbAdmin user list
instance_typestext[]e.g., ["m5.large"]
node_min_sizeintegerMinimum nodes
node_max_sizeintegerMaximum nodes
node_desired_sizeintegerDesired nodes
statuscomponent_status enum
cluster_nametextPopulated after provisioning
cluster_endpointtextPopulated after provisioning
cluster_arntextPopulated after provisioning
argocd_urltextPopulated after ArgoCD install
argocd_admin_passwordtextPopulated after ArgoCD install

vine_dns

Route53 / Cloud DNS / Azure DNS configuration.

ColumnTypeDescription
iduuid (PK)
vine_iduuid (UNIQUE FK)
enabledboolean
zone_idtextExisting hosted zone
domain_nametext
managed_certificatebooleanACM / managed cert
waf_enabledboolean
provider_configjsonb
statuscomponent_status enum

vine_repositories

Git repository references for infra, GitOps, and application code.

ColumnTypeDescription
iduuid (PK)
vine_iduuid (UNIQUE FK)
env_template_repotextInfrastructure template source
env_template_branchtext
env_destination_repotextInfrastructure output destination
gitops_template_repotextGitOps template source
gitops_template_branchtext
gitops_destination_repotextGitOps output destination
apps_template_repotextApplication template source
apps_template_branchtext
apps_destination_repotextApplication output destination

Vine Component Tables (Multi-Instance — 1:N per Vine)

vine_databases

Aurora / Cloud SQL / Azure Database instances.

ColumnTypeDescription
iduuid (PK)
vine_iduuid (FK)
nametextUnique per vine
enginetextaurora-postgresql (default), aurora-mysql, etc.
engine_versiontexte.g., 16.4
min_capacitynumericAurora Serverless min ACU
max_capacitynumericAurora Serverless max ACU
portinteger
backup_retention_daysinteger
iam_authbooleanIAM database authentication
statuscomponent_status enum
endpointtextWriter endpoint (populated after provisioning)
reader_endpointtextReader endpoint
cluster_identifiertext
master_credentials_secret_arntextSecrets Manager ARN

Constraint: UNIQUE(vine_id, name)

vine_caches

ElastiCache / Memorystore / Azure Cache instances.

ColumnTypeDescription
iduuid (PK)
vine_iduuid (FK)
nametextUnique per vine
enginecache_engine enumredis / valkey
node_typetexte.g., cache.r6g.large
num_cache_nodesinteger
multi_azboolean
allowed_cidr_blockstext[]
statuscomponent_status enum
endpointtextPopulated after provisioning
estimated_monthly_costnumeric

vine_nosql_tables

DynamoDB / Firestore / Cosmos DB tables.

ColumnTypeDescription
iduuid (PK)
vine_iduuid (FK)
nametext
table_typenosql_table_type enum
hash_keytextPartition key name
hash_key_typenosql_key_type enumS (string), N (number), B (binary)
range_keytextSort key name (optional)
range_key_typenosql_key_type enum
billing_modenosql_billing_mode enumPAY_PER_REQUEST / PROVISIONED
point_in_time_recoveryboolean
provider_configjsonb
statuscomponent_status enum

vine_queues

SQS / Pub/Sub / Service Bus queues.

ColumnTypeDescription
iduuid (PK)
vine_iduuid (FK)
nametext
fifobooleanFIFO ordering guarantee
visibility_timeoutintegerSeconds
message_retentionintegerSeconds
delay_secondsinteger
statuscomponent_status enum

vine_topics

SNS / Pub/Sub / Service Bus topics.

ColumnTypeDescription
iduuid (PK)
vine_iduuid (FK)
nametext
subscriptionsjsonbArray of subscription configs
statuscomponent_status enum

vine_container_registries

ECR / Artifact Registry / ACR repositories.

ColumnTypeDescription
iduuid (PK)
vine_iduuid (FK)
nametext
image_tag_mutabilityregistry_tag_mutability enumMUTABLE / IMMUTABLE
scan_on_pushboolean
repository_urltextPopulated after provisioning
provider_configjsonb
statuscomponent_status enum

vine_secrets

Secrets Manager / Secret Manager / Key Vault entries.

ColumnTypeDescription
iduuid (PK)
vine_iduuid (FK)
nametextSecret name
generatebooleanAuto-generate a random value
lengthintegerGenerated password length
special_charsbooleanInclude special characters
statuscomponent_status enum

Job Tables

provision_jobs

ColumnTypeDescription
iduuid (PK)
user_iduuid (FK)Owner
vine_iduuid (FK)Target vine
cloud_identity_iduuid (FK)Cloud account for execution
job_typetextCONNECTION_TEST, PLAN, DEPLOY, etc.
statusprovision_job_status enumQUEUED → SUCCESS/FAILED
worker_iduuid (FK → workers)Assigned Tendril
error_messagetextFailure details
execution_metadatajsonbTerraform outputs, cost data, timing
created_attimestamptz
claimed_attimestamptzWhen Tendril claimed it
started_attimestamptzWhen execution began
completed_attimestamptz

provision_job_logs

ColumnTypeDescription
iduuid (PK)
job_iduuid (FK → provision_jobs)
log_chunktextLog content batch
stream_typetextSTDOUT / STDERR / SYSTEM
created_attimestamptz

Realtime subscription: clients subscribe to INSERT events on this table filtered by job_id for live log streaming.

Worker Tables

workers

Registered Tendril agents.

ColumnTypeDescription
iduuid (PK)
user_iduuid (FK)Owner
nametextDisplay name
modeworker_mode enumself-hosted / cloud-hosted
statusworker_status enumONLINE / OFFLINE / DRAINING
token_hashtextHashed authentication token
versiontextTendril version string
release_iduuid (FK → worker_releases)Current release
last_heartbeattimestamptzLast heartbeat timestamp
created_attimestamptz

worker_releases

Release catalog for Tendril versions.

ColumnTypeDescription
iduuid (PK)
versiontext (UNIQUE)Semantic version
release_notestextChangelog content
released_attimestamptz

Audit Table

vine_audit_log

ColumnTypeDescription
iduuid (PK)
vine_iduuid (FK)
user_iduuid (FK)Who performed the action
actionaudit_action enumCREATED, UPDATED, DELETED, PROVISIONED, DESTROYED
component_typetextWhich component was affected
component_iduuid
changesjsonbBefore/after diff
created_attimestamptz

Key Enums

-- Vine lifecycle
CREATE TYPE vine_status AS ENUM (
  'DRAFT', 'QUEUED', 'PROVISIONING', 'ACTIVE',
  'FAILED', 'DESTROYING', 'DESTROYED'
);

-- Component lifecycle
CREATE TYPE component_status AS ENUM (
  'PENDING', 'CREATING', 'ACTIVE', 'UPDATING',
  'FAILED', 'DESTROYING', 'DESTROYED'
);

-- Job lifecycle
CREATE TYPE provision_job_status AS ENUM (
  'QUEUED', 'CLAIMED', 'PROCESSING',
  'SUCCESS', 'FAILED', 'CANCELLED'
);

-- Worker status
CREATE TYPE worker_mode AS ENUM ('self-hosted', 'cloud-hosted');
CREATE TYPE worker_status AS ENUM ('ONLINE', 'OFFLINE', 'DRAINING');

-- Environment
CREATE TYPE environment_stage AS ENUM ('development', 'staging', 'production');

-- Cache engines
CREATE TYPE cache_engine AS ENUM ('redis', 'valkey');

-- NoSQL
CREATE TYPE nosql_table_type AS ENUM (...);
CREATE TYPE nosql_key_type AS ENUM ('S', 'N', 'B');
CREATE TYPE nosql_billing_mode AS ENUM ('PAY_PER_REQUEST', 'PROVISIONED');

Key Database Functions

claim_next_job()

Atomic job claiming using FOR UPDATE SKIP LOCKED:

CREATE OR REPLACE FUNCTION claim_next_job(p_worker_id uuid)
RETURNS provision_jobs AS $$
DECLARE
  job provision_jobs;
BEGIN
  SELECT * INTO job
  FROM provision_jobs
  WHERE status = 'QUEUED'
  ORDER BY created_at ASC
  FOR UPDATE SKIP LOCKED
  LIMIT 1;

  IF job IS NOT NULL THEN
    UPDATE provision_jobs
    SET status = 'CLAIMED',
        worker_id = p_worker_id,
        claimed_at = now()
    WHERE id = job.id;
  END IF;

  RETURN job;
END;
$$ LANGUAGE plpgsql;

This guarantees that if two Tendrils poll simultaneously, only one gets the job. The SKIP LOCKED clause means the second Tendril skips the locked row and either gets the next one or gets nothing.

Realtime Subscriptions

The following tables are published via Supabase Realtime for live UI updates:

  • provision_job_logs — log streaming (INSERT events)
  • provision_jobs — job status changes (UPDATE events)
  • workers — Tendril status changes (UPDATE events)

On this page