Skip to content

public.lease

Columns

Name Type Default Nullable Children Parents Comment
claimedAt timestamp(3) with time zone true The time at which the holder claimed the lease
createdAt timestamp(3) with time zone CURRENT_TIMESTAMP(3) false
data json false The data that the holder needs, as canonical JSON
dataHash varchar(64) false The SHA-256 of data, which sync compares to find changed leases
fencingToken bigint 0 false The fencing token of the current or last holder
key varchar(255) false The key of the lease in its kind
leaseKind varchar(24) false public.lease_kind
leaseSessionId uuid true The holder session, or null when the lease is free, with no foreign key or unique index so that updates stay no-key updates
readyAt timestamp(3) with time zone true The time at which the holder reported the lease as ready
revokedAt timestamp(3) with time zone true The time at which sync revoked the lease because it changed or went, or null when not revoked; the hand-over deadline counts from it
updatedAt timestamp(3) with time zone CURRENT_TIMESTAMP(3) false

Constraints

Name Type Definition
CHK_lease_fencingToken CHECK CHECK (("fencingToken" >= 0))
FK_lease_leaseKind FOREIGN KEY FOREIGN KEY ("leaseKind") REFERENCES lease_kind(kind) ON DELETE CASCADE
PK_c9b9277380ffae18103999d14bf PRIMARY KEY PRIMARY KEY ("leaseKind", key)
lease_createdAt_not_null n NOT NULL "createdAt"
lease_dataHash_not_null n NOT NULL "dataHash"
lease_data_not_null n NOT NULL data
lease_fencingToken_not_null n NOT NULL "fencingToken"
lease_key_not_null n NOT NULL key
lease_leaseKind_not_null n NOT NULL "leaseKind"
lease_updatedAt_not_null n NOT NULL "updatedAt"

Indexes

Name Definition
IDX_lease_leaseKind_leaseSessionId CREATE INDEX "IDX_lease_leaseKind_leaseSessionId" ON public.lease USING btree ("leaseKind", "leaseSessionId")
PK_c9b9277380ffae18103999d14bf CREATE UNIQUE INDEX "PK_c9b9277380ffae18103999d14bf" ON public.lease USING btree ("leaseKind", key)

Relations

erDiagram

"public.lease" }o--|| "public.lease_kind" : "FOREIGN KEY (#quot;leaseKind#quot;) REFERENCES lease_kind(kind) ON DELETE CASCADE"

"public.lease" {
  timestamp_3__with_time_zone claimedAt
  timestamp_3__with_time_zone createdAt
  json data
  varchar_64_ dataHash
  bigint fencingToken
  varchar_255_ key
  varchar_24_ leaseKind FK
  uuid leaseSessionId
  timestamp_3__with_time_zone readyAt
  timestamp_3__with_time_zone revokedAt
  timestamp_3__with_time_zone updatedAt
}
"public.lease_kind" {
  timestamp_3__with_time_zone createdAt
  bigint fencingTokenCounter
  varchar_24_ kind
  timestamp_3__with_time_zone lastFullSyncAt
  timestamp_3__with_time_zone syncLockExpiresAt
  uuid syncLockRoundId
  timestamp_3__with_time_zone updatedAt
}

Generated by tbls

Markdown source: View on AtomGit·Content from the open-source project n8/n8n