Table reference
Every table of the application schemas, generated from a running stack. For
how to connect, diagrams of the main tables and sample queries, see
Database for testers.
Null says yes when a column may be empty. Default shows what the
database fills in when an insert leaves the column out (identity and
sequence are generated ids). The check lines list the rules the database
itself enforces, such as the allowed status values: data that breaks them can
never be stored, whatever the API does.
public
Owned by backend: Users, catalog, carts, orders, coupons, gift cards, loyalty, the event feed, the traffic monitor.
app_user, card_refund_requests, cart_coupons, cart_items, cart_tenders, coupon_redemptions, coupons, currency_rates, domain_event_feed_head, domain_events, email_event, gift_card_transactions, gift_cards, loyalty_accounts, loyalty_transactions, mfa_challenge, mfa_credential, mfa_recovery_code, order_idempotency_keys, order_items, order_payments, order_refunds, orders, password_reset_token, payment_notifications, product_reviews, products, refresh_token, stock_command_outbox, stock_reservation_claims, traffic_log, traffic_masking_state, traffic_session_owner, user_entity_roles, vat_rates, webhook_deliveries, webhook_inbox_requests, webhook_inboxes, webhook_subscriptions, wishlist_items
Migration history: flyway_schema_history.
public.app_user
| Column |
Type |
Null |
Default |
Key |
References |
id |
integer |
|
identity |
PK |
|
chat_system_prompt |
character varying(5000) |
yes |
|
|
|
email |
character varying(255) |
|
|
unique |
|
first_name |
character varying(255) |
yes |
|
|
|
last_name |
character varying(255) |
yes |
|
|
|
password |
character varying(255) |
yes |
|
|
|
tool_system_prompt |
character varying(5000) |
yes |
|
|
|
username |
character varying(255) |
|
|
unique |
|
auth_provider |
character varying(100) |
yes |
|
|
|
email_verified |
boolean |
yes |
|
|
|
provider_subject |
character varying(255) |
yes |
|
|
|
token_version |
integer |
|
0 |
|
|
- unique (
auth_provider, provider_subject)
public.card_refund_requests
| Column |
Type |
Null |
Default |
Key |
References |
request_id |
uuid |
|
|
PK |
|
order_id |
bigint |
|
|
|
public.orders.id |
payment_id |
uuid |
|
|
|
|
amount |
numeric(10,2) |
|
|
|
|
reason |
character varying(255) |
yes |
|
|
|
created_at |
timestamp with time zone |
|
|
|
|
- check
CHECK ((amount > (0)::numeric))
public.cart_coupons
| Column |
Type |
Null |
Default |
Key |
References |
username |
character varying(255) |
|
|
PK |
|
coupon_id |
bigint |
|
|
|
public.coupons.id |
applied_at |
timestamp(6) without time zone |
|
|
|
|
public.cart_items
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
price |
numeric(10,2) |
|
|
|
|
quantity |
integer |
|
|
|
|
username |
character varying(255) |
|
|
|
|
version |
bigint |
yes |
|
|
|
product_id |
bigint |
|
|
|
public.products.id |
- unique (
username, product_id)
public.cart_tenders
| Column |
Type |
Null |
Default |
Key |
References |
username |
character varying(255) |
|
|
PK |
|
gift_card_code |
character varying(19) |
yes |
|
|
|
points |
bigint |
yes |
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
- check
CHECK (((points IS NULL) OR ((points >= 100) AND ((points % (100)::bigint) = 0))))
public.coupon_redemptions
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
coupon_id |
bigint |
|
|
|
public.coupons.id |
order_id |
bigint |
|
|
unique |
public.orders.id |
username |
character varying(255) |
|
|
|
|
discount_amount |
numeric(10,2) |
|
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
public.coupons
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
code |
character varying(32) |
|
|
unique |
|
description |
character varying(255) |
yes |
|
|
|
type |
character varying(16) |
|
|
|
|
discount_value |
numeric(10,2) |
|
|
|
|
min_order_amount |
numeric(10,2) |
yes |
|
|
|
valid_from |
timestamp(6) without time zone |
yes |
|
|
|
valid_until |
timestamp(6) without time zone |
yes |
|
|
|
max_redemptions |
integer |
yes |
|
|
|
per_user_limit |
integer |
|
|
|
|
redemption_count |
integer |
|
0 |
|
|
active |
boolean |
|
|
|
|
version |
bigint |
|
0 |
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
- check
CHECK ((discount_value > (0)::numeric))
- check
CHECK ((max_redemptions > 0))
- check
CHECK ((min_order_amount >= (0)::numeric))
- check
CHECK ((per_user_limit > 0))
- check
CHECK ((redemption_count >= 0))
- check
CHECK (((type)::text = ANY ((ARRAY['PERCENTAGE'::character varying, 'FIXED_AMOUNT'::character varying])::text[])))
public.currency_rates
| Column |
Type |
Null |
Default |
Key |
References |
code |
character(3) |
|
|
PK |
|
name |
character varying(64) |
|
|
|
|
symbol |
character varying(8) |
|
|
|
|
rate_to_usd |
numeric(12,6) |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
- check
CHECK ((code ~ '^[A-Z]{3}$'::text))
- check
CHECK ((rate_to_usd > (0)::numeric))
public.domain_event_feed_head
| Column |
Type |
Null |
Default |
Key |
References |
id |
integer |
|
|
PK |
|
last_position |
bigint |
|
|
|
|
public.domain_events
| Column |
Type |
Null |
Default |
Key |
References |
sequence |
bigint |
|
sequence |
PK |
|
event_id |
uuid |
|
|
unique |
|
type |
character varying(64) |
|
|
|
|
order_id |
bigint |
yes |
|
|
|
username |
character varying(255) |
yes |
|
|
|
occurred_at |
timestamp with time zone |
|
|
|
|
recorded_at |
timestamp with time zone |
|
|
|
|
payload |
text |
|
|
|
|
request_id |
character varying(128) |
yes |
|
|
|
trace_id |
character varying(32) |
yes |
|
|
|
span_id |
character varying(16) |
yes |
|
|
|
published_at |
timestamp with time zone |
yes |
|
|
|
feed_position |
bigint |
yes |
|
|
|
public.email_event
| Column |
Type |
Null |
Default |
Key |
References |
id |
integer |
|
identity |
PK |
|
created_at |
timestamp with time zone |
|
|
|
|
failure_reason |
character varying(1000) |
yes |
|
|
|
recipient_email |
character varying(255) |
|
|
|
|
status |
character varying(255) |
|
|
|
|
type |
character varying(255) |
|
|
|
|
updated_at |
timestamp with time zone |
|
|
|
|
user_id |
integer |
|
|
|
public.app_user.id |
destination |
character varying(255) |
yes |
|
|
|
payload |
text |
yes |
|
|
|
attempts |
integer |
|
0 |
|
|
next_attempt_at |
timestamp with time zone |
yes |
|
|
|
request_id |
uuid |
yes |
|
unique |
|
correlation_request_id |
character varying(128) |
yes |
|
|
|
traceparent |
character varying(55) |
yes |
|
|
|
- check
CHECK (((type)::text = ANY ((ARRAY['GENERIC'::character varying, 'PASSWORD_RESET_REQUESTED'::character varying, 'PASSWORD_RESET_CONFIRMED'::character varying, 'BACK_IN_STOCK'::character varying, 'ORDER_SHIPPED'::character varying, 'ORDER_DELIVERED'::character varying, 'RETURN_UPDATED'::character varying, 'PAYMENT_RECEIVED'::character varying, 'PAYMENT_FAILED'::character varying, 'SHIPMENT_OUT_FOR_DELIVERY'::character varying, 'SHIPMENT_DELIVERY_FAILED'::character varying, 'LOYALTY_POINTS_EARNED'::character varying, 'GIFT_CARD_ISSUED'::character varying])::text[])))
- check
CHECK (((status)::text = ANY ((ARRAY['QUEUED'::character varying, 'SENT_TO_SMTP_SINK'::character varying, 'FAILED'::character varying])::text[])))
public.gift_card_transactions
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
gift_card_id |
bigint |
|
|
|
public.gift_cards.id |
type |
character varying(16) |
|
|
|
|
amount |
numeric(10,2) |
|
|
|
|
balance_after |
numeric(10,2) |
|
|
|
|
order_id |
bigint |
yes |
|
|
public.orders.id |
reference |
character varying(80) |
yes |
|
|
|
actor |
character varying(255) |
yes |
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
- unique (
gift_card_id, type, reference)
- check
CHECK ((balance_after >= (0)::numeric))
- check
CHECK (((type)::text = ANY ((ARRAY['ISSUED'::character varying, 'REDEEMED'::character varying, 'RESTORED'::character varying, 'DISABLED'::character varying])::text[])))
public.gift_cards
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
code |
character varying(19) |
|
|
unique |
|
initial_amount |
numeric(10,2) |
|
|
|
|
balance |
numeric(10,2) |
|
|
|
|
expires_at |
timestamp(6) without time zone |
yes |
|
|
|
disabled_at |
timestamp(6) without time zone |
yes |
|
|
|
recipient_username |
character varying(255) |
yes |
|
|
|
note |
character varying(255) |
yes |
|
|
|
created_by |
character varying(255) |
|
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
- check
CHECK (((initial_amount >= (1)::numeric) AND (initial_amount <= (1000)::numeric) AND (balance >= (0)::numeric) AND (balance <= initial_amount)))
- check
CHECK (((code)::text ~ '^GC-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$'::text))
public.loyalty_accounts
| Column |
Type |
Null |
Default |
Key |
References |
username |
character varying(255) |
|
|
PK |
|
balance |
bigint |
|
|
|
|
lifetime_earned |
bigint |
|
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
- check
CHECK (((balance >= 0) AND (lifetime_earned >= 0)))
public.loyalty_transactions
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
username |
character varying(255) |
|
|
|
public.loyalty_accounts.username |
type |
character varying(16) |
|
|
|
|
points |
bigint |
|
|
|
|
balance_after |
bigint |
|
|
|
|
order_id |
bigint |
yes |
|
|
public.orders.id |
reference |
character varying(80) |
yes |
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
- unique (
username, type, reference)
- check
CHECK (((points <> 0) AND (balance_after >= 0)))
- check
CHECK (((type)::text = ANY ((ARRAY['EARNED'::character varying, 'REDEEMED'::character varying, 'RESTORED'::character varying, 'REVOKED'::character varying])::text[])))
public.mfa_challenge
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
consumed_at |
timestamp with time zone |
yes |
|
|
|
created_at |
timestamp with time zone |
|
|
|
|
expires_at |
timestamp with time zone |
|
|
|
|
token_hash |
character varying(64) |
|
|
unique |
|
version |
bigint |
|
|
|
|
user_id |
integer |
|
|
|
public.app_user.id |
failed_attempts |
integer |
|
0 |
|
|
public.mfa_credential
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
confirmed_at |
timestamp with time zone |
yes |
|
|
|
created_at |
timestamp with time zone |
|
|
|
|
enabled |
boolean |
|
|
|
|
last_accepted_time_step |
bigint |
yes |
|
|
|
secret_ciphertext |
character varying(2048) |
|
|
|
|
setup_expires_at |
timestamp with time zone |
|
|
|
|
version |
bigint |
|
|
|
|
user_id |
integer |
|
|
unique |
public.app_user.id |
public.mfa_recovery_code
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
created_at |
timestamp with time zone |
|
|
|
|
selector |
character varying(8) |
|
|
|
|
used_at |
timestamp with time zone |
yes |
|
|
|
verifier_hash |
character varying(255) |
|
|
|
|
version |
bigint |
|
|
|
|
credential_id |
bigint |
|
|
|
public.mfa_credential.id |
- unique (
credential_id, selector)
public.order_idempotency_keys
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
username |
character varying(255) |
|
|
|
|
idempotency_key |
character varying(64) |
|
|
|
|
request_hash |
character varying(64) |
|
|
|
|
order_id |
bigint |
|
|
|
public.orders.id |
created_at |
timestamp(6) without time zone |
|
|
|
|
- unique (
username, idempotency_key)
public.order_items
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
price |
numeric(10,2) |
|
|
|
|
quantity |
integer |
|
|
|
|
order_id |
bigint |
|
|
|
public.orders.id |
product_id |
bigint |
|
|
|
public.products.id |
public.order_payments
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
order_id |
bigint |
|
|
|
public.orders.id |
payment_id |
uuid |
|
|
unique |
|
status |
character varying(16) |
|
|
|
|
amount |
numeric(10,2) |
|
|
|
|
currency |
character varying(3) |
|
|
|
|
failure_code |
character varying(64) |
yes |
|
|
|
created_at |
timestamp with time zone |
|
|
|
|
- check
CHECK ((amount >= (0)::numeric))
- check
CHECK (((status)::text = ANY ((ARRAY['CAPTURED'::character varying, 'FAILED'::character varying])::text[])))
public.order_refunds
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
order_id |
bigint |
|
|
|
public.orders.id |
request_id |
uuid |
|
|
unique |
|
amount |
numeric(10,2) |
|
|
|
|
reference |
character varying(255) |
|
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
tax_amount |
numeric(10,2) |
yes |
|
|
|
- check
CHECK ((amount > (0)::numeric))
public.orders
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
created_at |
timestamp(6) without time zone |
|
|
|
|
city |
character varying(255) |
yes |
|
|
|
country |
character varying(255) |
yes |
|
|
|
state |
character varying(255) |
yes |
|
|
|
street |
character varying(255) |
yes |
|
|
|
zip_code |
character varying(255) |
yes |
|
|
|
status |
character varying(255) |
|
|
|
|
total_amount |
numeric(10,2) |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
username |
character varying(255) |
|
|
|
|
inventory_state |
character varying(32) |
|
'LEGACY_UNTRACKED'::character varying |
|
|
subtotal_amount |
numeric(10,2) |
yes |
|
|
|
discount_amount |
numeric(10,2) |
|
0 |
|
|
coupon_code |
character varying(32) |
yes |
|
|
|
fulfilment_state |
character varying(16) |
|
'NONE'::character varying |
|
|
refunded_amount |
numeric(10,2) |
|
0 |
|
|
gift_card_code |
character varying(19) |
yes |
|
|
|
gift_card_amount |
numeric(10,2) |
yes |
|
|
|
points_redeemed |
bigint |
yes |
|
|
|
points_amount |
numeric(10,2) |
yes |
|
|
|
tax_country |
character(2) |
yes |
|
|
|
tax_rate |
numeric(5,2) |
yes |
|
|
|
tax_amount |
numeric(10,2) |
yes |
|
|
|
net_amount |
numeric(10,2) |
yes |
|
|
|
reservation_expires_at |
timestamp with time zone |
yes |
|
|
|
stock_reservation_id |
uuid |
yes |
|
|
|
- check
CHECK (((discount_amount >= (0)::numeric) AND (discount_amount <= subtotal_amount)))
- check
CHECK (((fulfilment_state)::text = ANY ((ARRAY['NONE'::character varying, 'AWAITING_PICK'::character varying, 'PICKED'::character varying, 'PACKED'::character varying, 'SHIPPED'::character varying, 'DELIVERED'::character varying, 'CANCELLED'::character varying])::text[])))
- check
CHECK ((((gift_card_code IS NULL) AND (gift_card_amount IS NULL)) OR ((gift_card_code IS NOT NULL) AND (gift_card_amount > (0)::numeric))))
- check
CHECK (((inventory_state)::text = ANY ((ARRAY['DEDUCTED'::character varying, 'RESTORED'::character varying, 'LEGACY_UNTRACKED'::character varying])::text[])))
- check
CHECK ((((points_redeemed IS NULL) AND (points_amount IS NULL)) OR ((points_redeemed > 0) AND (points_amount = ((points_redeemed)::numeric / 100.0)))))
- check
CHECK (((refunded_amount >= (0)::numeric) AND (refunded_amount <= total_amount)))
- check
CHECK ((((tax_country IS NULL) AND (tax_rate IS NULL) AND (tax_amount IS NULL) AND (net_amount IS NULL)) OR ((tax_country IS NOT NULL) AND (tax_rate IS NOT NULL) AND (tax_amount IS NOT NULL) AND (net_amount IS NOT NULL) AND (tax_amount >= (0)::numeric) AND (net_amount >= (0)::numeric))))
- check
CHECK (((COALESCE(gift_card_amount, (0)::numeric) + COALESCE(points_amount, (0)::numeric)) <= total_amount))
- check
CHECK (((status)::text = ANY ((ARRAY['PENDING'::character varying, 'PAID'::character varying, 'SHIPPED'::character varying, 'DELIVERED'::character varying, 'CANCELLED'::character varying])::text[])))
public.password_reset_token
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
consumed_at |
timestamp with time zone |
yes |
|
|
|
expires_at |
timestamp with time zone |
|
|
|
|
request_ip |
character varying(64) |
yes |
|
|
|
requested_at |
timestamp with time zone |
|
|
|
|
token_hash |
character varying(128) |
|
|
unique |
|
user_agent |
character varying(255) |
yes |
|
|
|
user_id |
integer |
|
|
|
public.app_user.id |
version |
bigint |
|
|
|
|
public.payment_notifications
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
request_id |
uuid |
|
|
unique |
|
order_id |
bigint |
|
|
|
public.orders.id |
payment_id |
uuid |
|
|
|
|
status |
character varying(16) |
|
|
|
|
order_status |
character varying(32) |
|
|
|
|
created_at |
timestamp with time zone |
|
|
|
|
- check
CHECK (((status)::text = ANY ((ARRAY['CAPTURED'::character varying, 'FAILED'::character varying])::text[])))
public.product_reviews
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
product_id |
bigint |
|
|
|
public.products.id |
username |
character varying(255) |
|
|
|
|
rating |
integer |
|
|
|
|
title |
character varying(120) |
|
|
|
|
body |
character varying(2000) |
|
|
|
|
status |
character varying(16) |
|
|
|
|
moderation_note |
character varying(500) |
yes |
|
|
|
moderated_by |
character varying(255) |
yes |
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
- unique (
product_id, username)
- check
CHECK (((rating >= 1) AND (rating <= 5)))
- check
CHECK (((status)::text = ANY ((ARRAY['PENDING'::character varying, 'APPROVED'::character varying, 'REJECTED'::character varying])::text[])))
public.products
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
category |
character varying(255) |
|
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
description |
text |
|
|
|
|
image_url |
character varying(255) |
|
''::character varying |
|
|
name |
character varying(255) |
|
|
|
|
price |
numeric(10,2) |
|
|
|
|
stock_quantity |
integer |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
version |
bigint |
|
0 |
|
|
stock_ledger_version |
bigint |
|
0 |
|
|
- check
CHECK ((stock_quantity >= 0))
public.refresh_token
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
expires_at |
timestamp with time zone |
|
|
|
|
revoked |
boolean |
|
|
|
|
user_id |
integer |
|
|
|
public.app_user.id |
token_hash |
character varying(64) |
|
|
unique |
|
family_id |
character varying(36) |
|
|
|
|
created_at |
timestamp with time zone |
|
|
|
|
consumed_at |
timestamp with time zone |
yes |
|
|
|
replaced_by_token_hash |
character varying(64) |
yes |
|
|
|
public.stock_command_outbox
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
sequence |
PK |
|
command |
character varying(16) |
|
|
|
|
product_id |
bigint |
|
|
|
|
initial_quantity |
integer |
yes |
|
|
|
actor |
character varying(255) |
yes |
|
|
|
request_id |
uuid |
|
|
unique |
|
status |
character varying(16) |
|
|
|
|
attempts |
integer |
|
0 |
|
|
next_attempt_at |
timestamp with time zone |
|
|
|
|
last_error |
character varying(500) |
yes |
|
|
|
correlation_request_id |
character varying(128) |
yes |
|
|
|
traceparent |
character varying(55) |
yes |
|
|
|
created_at |
timestamp with time zone |
|
|
|
|
processed_at |
timestamp with time zone |
yes |
|
|
|
- check
CHECK (((command)::text = ANY ((ARRAY['INITIAL_STOCK'::character varying, 'DELETE'::character varying])::text[])))
- check
CHECK (((initial_quantity IS NULL) OR (initial_quantity >= 0)))
- check
CHECK (((status)::text = ANY ((ARRAY['PENDING'::character varying, 'DONE'::character varying])::text[])))
public.stock_reservation_claims
| Column |
Type |
Null |
Default |
Key |
References |
reservation_id |
uuid |
|
|
PK |
|
created_at |
timestamp with time zone |
|
|
|
|
public.traffic_log
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
client_session_id |
character varying(128) |
yes |
|
|
|
correlation_id |
character varying(64) |
|
|
unique |
|
duration_ms |
bigint |
|
|
|
|
method |
character varying(16) |
|
|
|
|
path |
character varying(1024) |
|
|
|
|
query_string |
character varying(2000) |
yes |
|
|
|
request_body |
text |
yes |
|
|
|
request_headers |
text |
yes |
|
|
|
response_body |
text |
yes |
|
|
|
response_headers |
text |
yes |
|
|
|
status |
integer |
|
|
|
|
timestamp |
timestamp with time zone |
|
|
|
|
request_content_type |
character varying(255) |
yes |
|
|
|
response_content_type |
character varying(255) |
yes |
|
|
|
request_body_truncated |
boolean |
|
false |
|
|
request_body_original_length |
integer |
|
0 |
|
|
request_body_stored_length |
integer |
|
0 |
|
|
response_body_truncated |
boolean |
|
false |
|
|
response_body_original_length |
integer |
|
0 |
|
|
response_body_stored_length |
integer |
|
0 |
|
|
owner_username |
character varying(255) |
yes |
|
|
|
public.traffic_masking_state
| Column |
Type |
Null |
Default |
Key |
References |
id |
smallint |
|
|
PK |
|
rules_version |
integer |
|
|
|
|
public.traffic_session_owner
| Column |
Type |
Null |
Default |
Key |
References |
client_session_id |
character varying(128) |
|
|
PK |
|
username |
character varying(255) |
|
|
|
|
bound_at |
timestamp with time zone |
|
|
|
|
public.user_entity_roles
| Column |
Type |
Null |
Default |
Key |
References |
user_entity_id |
integer |
|
|
|
public.app_user.id |
roles |
smallint |
yes |
|
|
|
- check
CHECK (((roles >= 0) AND (roles <= 2)))
public.vat_rates
| Column |
Type |
Null |
Default |
Key |
References |
country_code |
character(2) |
|
|
PK |
|
country_name |
character varying(64) |
|
|
|
|
rate |
numeric(5,2) |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
- check
CHECK ((country_code ~ '^[A-Z]{2}$'::text))
- check
CHECK (((rate >= (0)::numeric) AND (rate <= (50)::numeric)))
public.webhook_deliveries
| Column |
Type |
Null |
Default |
Key |
References |
id |
uuid |
|
|
PK |
|
subscription_id |
bigint |
|
|
|
public.webhook_subscriptions.id |
event_id |
uuid |
|
|
|
|
event_type |
character varying(64) |
|
|
|
|
payload |
text |
|
|
|
|
status |
character varying(16) |
|
|
|
|
attempts |
integer |
|
0 |
|
|
next_attempt_at |
timestamp with time zone |
yes |
|
|
|
last_status_code |
integer |
yes |
|
|
|
last_error |
character varying(1000) |
yes |
|
|
|
response_snippet |
character varying(500) |
yes |
|
|
|
duration_ms |
bigint |
yes |
|
|
|
created_at |
timestamp with time zone |
|
|
|
|
delivered_at |
timestamp with time zone |
yes |
|
|
|
request_id |
character varying(128) |
yes |
|
|
|
traceparent |
character varying(55) |
yes |
|
|
|
- check
CHECK ((attempts >= 0))
- check
CHECK (((status)::text = ANY ((ARRAY['PENDING'::character varying, 'DELIVERED'::character varying, 'FAILED'::character varying])::text[])))
public.webhook_inbox_requests
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
inbox_id |
bigint |
|
|
|
public.webhook_inboxes.id |
received_at |
timestamp with time zone |
|
|
|
|
headers |
text |
|
|
|
|
body |
text |
|
|
|
|
- check
CHECK ((length(body) <= 16384))
public.webhook_inboxes
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
token |
character varying(64) |
|
|
unique |
|
username |
character varying(255) |
|
|
|
|
created_at |
timestamp with time zone |
|
|
|
|
public.webhook_subscriptions
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
username |
character varying(255) |
|
|
|
|
url |
character varying(2048) |
|
|
|
|
description |
character varying(255) |
yes |
|
|
|
events |
character varying(1000) |
|
|
|
|
secret |
character varying(512) |
|
|
|
|
active |
boolean |
|
true |
|
|
consecutive_failures |
integer |
|
0 |
|
|
disabled_reason |
character varying(500) |
yes |
|
|
|
created_at |
timestamp with time zone |
|
|
|
|
updated_at |
timestamp with time zone |
|
|
|
|
- check
CHECK ((consecutive_failures >= 0))
public.wishlist_items
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
username |
character varying(255) |
|
|
|
|
product_id |
bigint |
|
|
|
public.products.id |
notify_when_available |
boolean |
|
|
|
|
last_notified_at |
timestamp(6) without time zone |
yes |
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
- unique (
username, product_id)
warehouse
Owned by warehouse-service: Stock ledger and reservations, shipments, tracking, returns, suppliers, purchase orders.
event_cursors, location_products, notification_outbox, order_locks, processed_events, purchase_order_lines, purchase_orders, purchase_receipts, return_items, return_requests, shipment_lines, shipments, stock_items, stock_level_outbox, stock_movements, stock_reservation_lines, stock_reservations, stock_restores, suppliers, tracking_events, warehouse_locations
Migration history: flyway_schema_history.
warehouse.event_cursors
| Column |
Type |
Null |
Default |
Key |
References |
consumer |
character varying(64) |
|
|
PK |
|
last_sequence |
bigint |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
warehouse.location_products
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
location_code |
character varying(8) |
|
|
|
warehouse.warehouse_locations.code |
category |
character varying(255) |
|
|
|
|
role |
character varying(16) |
|
|
|
|
- unique (
location_code, category)
- check
CHECK (((role)::text = ANY ((ARRAY['PRIMARY'::character varying, 'BACKUP'::character varying])::text[])))
warehouse.notification_outbox
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
request_id |
uuid |
|
|
unique |
|
username |
character varying(255) |
|
|
|
|
properties |
character varying(4000) |
|
|
|
|
attempts |
integer |
|
0 |
|
|
next_attempt_at |
timestamp(6) without time zone |
|
|
|
|
sent_at |
timestamp(6) without time zone |
yes |
|
|
|
last_error |
character varying(500) |
yes |
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
template |
character varying(32) |
|
|
|
|
correlation_id |
character varying(128) |
yes |
|
|
|
traceparent |
character varying(55) |
yes |
|
|
|
- check
CHECK (((template)::text = ANY ((ARRAY['ORDER_SHIPPED'::character varying, 'ORDER_DELIVERED'::character varying, 'RETURN_UPDATED'::character varying, 'SHIPMENT_OUT_FOR_DELIVERY'::character varying, 'SHIPMENT_DELIVERY_FAILED'::character varying])::text[])))
warehouse.order_locks
| Column |
Type |
Null |
Default |
Key |
References |
order_id |
bigint |
|
|
PK |
|
mirrored_state |
character varying(16) |
yes |
|
|
|
- check
CHECK (((mirrored_state)::text = ANY ((ARRAY['NONE'::character varying, 'AWAITING_PICK'::character varying, 'PICKED'::character varying, 'PACKED'::character varying, 'SHIPPED'::character varying, 'DELIVERED'::character varying, 'CANCELLED'::character varying])::text[])))
warehouse.processed_events
| Column |
Type |
Null |
Default |
Key |
References |
event_id |
uuid |
|
|
PK |
|
processed_at |
timestamp(6) without time zone |
|
|
|
|
warehouse.purchase_order_lines
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
purchase_order_id |
bigint |
|
|
|
warehouse.purchase_orders.id |
product_id |
bigint |
|
|
|
|
product_name |
character varying(255) |
|
|
|
|
ordered_quantity |
integer |
|
|
|
|
received_quantity |
integer |
|
0 |
|
|
unit_cost |
numeric(10,2) |
|
|
|
|
- unique (
purchase_order_id, product_id)
- check
CHECK (((received_quantity >= 0) AND (received_quantity <= ordered_quantity)))
- check
CHECK ((ordered_quantity > 0))
- check
CHECK ((unit_cost > (0)::numeric))
warehouse.purchase_orders
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
supplier_id |
bigint |
|
|
|
warehouse.suppliers.id |
status |
character varying(24) |
|
|
|
|
note |
character varying(500) |
yes |
|
|
|
created_by |
character varying(255) |
|
|
|
|
version |
bigint |
|
0 |
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
submitted_at |
timestamp(6) without time zone |
yes |
|
|
|
expected_at |
timestamp(6) without time zone |
yes |
|
|
|
received_at |
timestamp(6) without time zone |
yes |
|
|
|
cancelled_at |
timestamp(6) without time zone |
yes |
|
|
|
- check
CHECK (((status)::text = ANY ((ARRAY['DRAFT'::character varying, 'SUBMITTED'::character varying, 'PARTIALLY_RECEIVED'::character varying, 'RECEIVED'::character varying, 'CANCELLED'::character varying])::text[])))
warehouse.purchase_receipts
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
purchase_order_id |
bigint |
|
|
|
warehouse.purchase_orders.id |
request_id |
uuid |
|
|
|
|
lines_fingerprint |
character varying(64) |
|
|
|
|
received_by |
character varying(255) |
|
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
- unique (
purchase_order_id, request_id)
warehouse.return_items
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
return_id |
bigint |
|
|
|
warehouse.return_requests.id |
product_id |
bigint |
|
|
|
|
product_name |
character varying(255) |
|
|
|
|
quantity |
integer |
|
|
|
|
unit_price |
numeric(10,2) |
|
|
|
|
item_condition |
character varying(16) |
yes |
|
|
|
- check
CHECK (((item_condition)::text = ANY ((ARRAY['RESELLABLE'::character varying, 'DAMAGED'::character varying])::text[])))
- check
CHECK ((quantity > 0))
warehouse.return_requests
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
order_id |
bigint |
|
|
|
|
order_total_amount |
numeric(10,2) |
|
|
|
|
order_subtotal_amount |
numeric(10,2) |
yes |
|
|
|
username |
character varying(255) |
|
|
|
|
status |
character varying(16) |
|
|
|
|
reason |
character varying(32) |
|
|
|
|
customer_comment |
character varying(1000) |
yes |
|
|
|
resolution_note |
character varying(500) |
yes |
|
|
|
refund_amount |
numeric(10,2) |
yes |
|
|
|
version |
bigint |
|
0 |
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
approved_at |
timestamp(6) without time zone |
yes |
|
|
|
rejected_at |
timestamp(6) without time zone |
yes |
|
|
|
received_at |
timestamp(6) without time zone |
yes |
|
|
|
refunded_at |
timestamp(6) without time zone |
yes |
|
|
|
- check
CHECK (((reason)::text = ANY ((ARRAY['DAMAGED'::character varying, 'WRONG_ITEM'::character varying, 'NOT_AS_DESCRIBED'::character varying, 'NO_LONGER_NEEDED'::character varying])::text[])))
- check
CHECK (((status)::text = ANY ((ARRAY['REQUESTED'::character varying, 'APPROVED'::character varying, 'REJECTED'::character varying, 'RECEIVED'::character varying, 'REFUNDED'::character varying])::text[])))
warehouse.shipment_lines
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
shipment_id |
bigint |
|
|
|
warehouse.shipments.id |
product_id |
bigint |
|
|
|
|
product_name |
character varying(255) |
|
|
|
|
category |
character varying(255) |
yes |
|
|
|
quantity |
integer |
|
|
|
|
- unique (
shipment_id, product_id)
- check
CHECK ((quantity > 0))
warehouse.shipments
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
order_id |
bigint |
|
|
|
|
username |
character varying(255) |
|
|
|
|
total_units |
integer |
|
|
|
|
status |
character varying(16) |
|
|
|
|
carrier |
character varying(16) |
yes |
|
|
|
tracking_number |
character varying(32) |
yes |
|
|
|
weight_kg |
numeric(5,2) |
yes |
|
|
|
created_by |
character varying(255) |
|
|
|
|
last_actor |
character varying(255) |
|
|
|
|
version |
bigint |
|
0 |
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
picked_at |
timestamp(6) without time zone |
yes |
|
|
|
packed_at |
timestamp(6) without time zone |
yes |
|
|
|
shipped_at |
timestamp(6) without time zone |
yes |
|
|
|
delivered_at |
timestamp(6) without time zone |
yes |
|
|
|
cancelled_at |
timestamp(6) without time zone |
yes |
|
|
|
simulated |
boolean |
|
false |
|
|
location_code |
character varying(8) |
|
|
|
warehouse.warehouse_locations.code |
lines_pending |
boolean |
|
false |
|
|
- unique (
order_id, location_code)
- check
CHECK (((carrier)::text = ANY ((ARRAY['INPOST'::character varying, 'DPD'::character varying, 'DHL'::character varying, 'UPS'::character varying])::text[])))
- check
CHECK (((status)::text = ANY ((ARRAY['AWAITING_PICK'::character varying, 'PICKED'::character varying, 'PACKED'::character varying, 'SHIPPED'::character varying, 'DELIVERED'::character varying, 'CANCELLED'::character varying])::text[])))
- check
CHECK ((total_units >= 0))
- check
CHECK ((weight_kg > (0)::numeric))
warehouse.stock_items
| Column |
Type |
Null |
Default |
Key |
References |
product_id |
bigint |
|
|
PK |
|
quantity |
integer |
|
|
|
|
ledger_version |
bigint |
|
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
- check
CHECK ((quantity >= 0))
warehouse.stock_level_outbox
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
product_id |
bigint |
|
|
|
|
quantity |
integer |
|
|
|
|
ledger_version |
bigint |
|
|
|
|
attempts |
integer |
|
0 |
|
|
last_error |
character varying(500) |
yes |
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
correlation_id |
character varying(128) |
yes |
|
|
|
traceparent |
character varying(55) |
yes |
|
|
|
warehouse.stock_movements
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
product_id |
bigint |
|
|
|
warehouse.stock_items.product_id |
order_id |
bigint |
yes |
|
|
|
reservation_id |
uuid |
yes |
|
|
|
type |
character varying(32) |
|
|
|
|
delta |
integer |
|
|
|
|
quantity_after |
integer |
|
|
|
|
actor |
character varying(255) |
|
|
|
|
reason |
character varying(500) |
|
|
|
|
request_id |
uuid |
yes |
|
|
|
ledger_version |
bigint |
yes |
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
- unique (
product_id, request_id)
- check
CHECK (((type)::text = ANY ((ARRAY['INITIAL_STOCK'::character varying, 'ADMIN_ADJUSTMENT'::character varying, 'ORDER_DEDUCTED'::character varying, 'ORDER_RESTORED'::character varying, 'PURCHASE_RECEIVED'::character varying, 'RETURN_RESTOCKED'::character varying])::text[])))
warehouse.stock_reservation_lines
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
reservation_id |
uuid |
|
|
|
warehouse.stock_reservations.reservation_id |
product_id |
bigint |
|
|
|
|
quantity |
integer |
|
|
|
|
quantity_after |
integer |
|
|
|
|
ledger_version |
bigint |
|
|
|
|
- unique (
reservation_id, product_id)
- check
CHECK ((quantity > 0))
warehouse.stock_reservations
| Column |
Type |
Null |
Default |
Key |
References |
reservation_id |
uuid |
|
|
PK |
|
username |
character varying(255) |
|
|
|
|
status |
character varying(32) |
|
|
|
|
order_id |
bigint |
yes |
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
correlation_id |
character varying(128) |
yes |
|
|
|
traceparent |
character varying(55) |
yes |
|
|
|
- check
CHECK (((status)::text = ANY ((ARRAY['PENDING_CONFIRMATION'::character varying, 'CONFIRMED'::character varying, 'RELEASED'::character varying])::text[])))
warehouse.stock_restores
| Column |
Type |
Null |
Default |
Key |
References |
order_id |
bigint |
|
|
PK |
|
event_id |
uuid |
|
|
|
|
restored_at |
timestamp(6) without time zone |
|
|
|
|
warehouse.suppliers
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
name |
character varying(120) |
|
|
unique |
|
email |
character varying(255) |
|
|
|
|
lead_time_days |
integer |
|
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
- check
CHECK (((lead_time_days >= 0) AND (lead_time_days <= 365)))
warehouse.tracking_events
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
shipment_id |
bigint |
|
|
|
warehouse.shipments.id |
status |
character varying(24) |
|
|
|
|
location |
character varying(120) |
|
|
|
|
description |
character varying(255) |
|
|
|
|
occurred_at |
timestamp(6) without time zone |
|
|
|
|
- check
CHECK (((status)::text = ANY ((ARRAY['LABEL_CREATED'::character varying, 'IN_TRANSIT'::character varying, 'OUT_FOR_DELIVERY'::character varying, 'DELIVERY_FAILED'::character varying, 'DELIVERED'::character varying])::text[])))
warehouse.warehouse_locations
| Column |
Type |
Null |
Default |
Key |
References |
code |
character varying(8) |
|
|
PK |
|
name |
character varying(120) |
|
|
|
|
city |
character varying(120) |
|
|
|
|
active |
boolean |
|
true |
|
|
priority |
integer |
|
|
|
|
- check
CHECK ((priority > 0))
payment
Owned by payment-service: Card payments, refunds, idempotency keys.
event_cursors, order_payment_locks, payment_idempotency_keys, payment_outbox, payments, processed_events, refunds
Migration history: flyway_schema_history.
payment.event_cursors
| Column |
Type |
Null |
Default |
Key |
References |
consumer |
character varying(64) |
|
|
PK |
|
last_sequence |
bigint |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
payment.order_payment_locks
| Column |
Type |
Null |
Default |
Key |
References |
order_id |
bigint |
|
|
PK |
|
payment.payment_idempotency_keys
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
username |
character varying(255) |
|
|
|
|
idempotency_key |
character varying(64) |
|
|
|
|
request_hash |
character varying(64) |
|
|
|
|
payment_id |
uuid |
|
|
|
payment.payments.id |
created_at |
timestamp(6) without time zone |
|
|
|
|
- unique (
username, idempotency_key)
payment.payment_outbox
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
request_id |
uuid |
|
|
|
|
payment_id |
uuid |
|
|
|
payment.payments.id |
order_id |
bigint |
|
|
|
|
payload |
character varying(2000) |
|
|
|
|
attempts |
integer |
|
0 |
|
|
next_attempt_at |
timestamp(6) without time zone |
|
|
|
|
sent_at |
timestamp(6) without time zone |
yes |
|
|
|
last_error |
character varying(500) |
yes |
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
correlation_request_id |
character varying(128) |
yes |
|
|
|
traceparent |
character varying(55) |
yes |
|
|
|
payment.payments
| Column |
Type |
Null |
Default |
Key |
References |
id |
uuid |
|
|
PK |
|
order_id |
bigint |
|
|
|
|
username |
character varying(255) |
|
|
|
|
status |
character varying(32) |
|
|
|
|
amount |
numeric(12,2) |
|
|
|
|
refunded_amount |
numeric(12,2) |
|
0 |
|
|
currency |
character varying(3) |
|
|
|
|
card_brand |
character varying(16) |
|
|
|
|
card_last4 |
character varying(4) |
|
|
|
|
failure_code |
character varying(32) |
yes |
|
|
|
failure_message |
character varying(255) |
yes |
|
|
|
settlement |
character varying(16) |
yes |
|
|
|
settle_at |
timestamp(6) without time zone |
yes |
|
|
|
version |
bigint |
|
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
correlation_request_id |
character varying(128) |
yes |
|
|
|
traceparent |
character varying(55) |
yes |
|
|
|
- check
CHECK ((refunded_amount <= amount))
- check
CHECK ((amount > (0)::numeric))
- check
CHECK (((card_brand)::text = ANY ((ARRAY['VISA'::character varying, 'MASTERCARD'::character varying, 'AMEX'::character varying, 'OTHER'::character varying])::text[])))
- check
CHECK ((refunded_amount >= (0)::numeric))
- check
CHECK (((settlement)::text = ANY ((ARRAY['CAPTURE'::character varying, 'TIMEOUT'::character varying])::text[])))
- check
CHECK (((status)::text = ANY ((ARRAY['REQUIRES_ACTION'::character varying, 'PROCESSING'::character varying, 'CAPTURED'::character varying, 'FAILED'::character varying, 'PARTIALLY_REFUNDED'::character varying, 'REFUNDED'::character varying, 'VOIDED'::character varying])::text[])))
payment.processed_events
| Column |
Type |
Null |
Default |
Key |
References |
event_id |
uuid |
|
|
PK |
|
processed_at |
timestamp(6) without time zone |
|
|
|
|
payment.refunds
| Column |
Type |
Null |
Default |
Key |
References |
id |
uuid |
|
|
PK |
|
request_id |
uuid |
|
|
unique |
|
payment_id |
uuid |
|
|
|
payment.payments.id |
order_id |
bigint |
|
|
|
|
amount |
numeric(12,2) |
|
|
|
|
reason |
character varying(255) |
yes |
|
|
|
payment_status |
character varying(32) |
|
|
|
|
created_at |
timestamp(6) without time zone |
|
|
|
|
correlation_request_id |
character varying(128) |
yes |
|
|
|
trace_id |
character varying(32) |
yes |
|
|
|
- check
CHECK ((amount > (0)::numeric))
notification
Owned by notification-service: Commerce emails and user webhooks.
event_cursors, notification_emails, processed_events, webhook_deliveries, webhook_inbox_requests, webhook_inboxes, webhook_subscriptions
Migration history: flyway_schema_history.
notification.event_cursors
| Column |
Type |
Null |
Default |
Key |
References |
consumer |
character varying(64) |
|
|
PK |
|
last_sequence |
bigint |
|
|
|
|
updated_at |
timestamp(6) without time zone |
|
|
|
|
notification.notification_emails
| Column |
Type |
Null |
Default |
Key |
References |
id |
uuid |
|
|
PK |
|
request_id |
uuid |
|
|
unique |
|
event_id |
uuid |
|
|
|
|
username |
character varying(255) |
|
|
|
|
recipient_email |
character varying(320) |
|
|
|
|
template |
character varying(64) |
|
|
|
|
subject |
character varying(1000) |
|
|
|
|
message |
character varying(16384) |
|
|
|
|
properties |
character varying(16384) |
|
|
|
|
status |
character varying(16) |
|
|
|
|
attempts |
integer |
|
0 |
|
|
next_attempt_at |
timestamp(6) with time zone |
yes |
|
|
|
sent_at |
timestamp(6) with time zone |
yes |
|
|
|
last_error |
character varying(1000) |
yes |
|
|
|
created_at |
timestamp(6) with time zone |
|
|
|
|
updated_at |
timestamp(6) with time zone |
|
|
|
|
correlation_request_id |
character varying(128) |
yes |
|
|
|
traceparent |
character varying(55) |
yes |
|
|
|
- check
CHECK ((attempts >= 0))
- check
CHECK (((status)::text = ANY ((ARRAY['QUEUED'::character varying, 'SENT'::character varying, 'FAILED'::character varying])::text[])))
notification.processed_events
| Column |
Type |
Null |
Default |
Key |
References |
event_id |
uuid |
|
|
PK |
|
processed_at |
timestamp(6) without time zone |
|
|
|
|
notification.webhook_deliveries
| Column |
Type |
Null |
Default |
Key |
References |
id |
uuid |
|
|
PK |
|
subscription_id |
bigint |
|
|
|
notification.webhook_subscriptions.id |
event_id |
uuid |
|
|
|
|
event_type |
character varying(64) |
|
|
|
|
payload |
character varying(65536) |
|
|
|
|
status |
character varying(16) |
|
|
|
|
attempts |
integer |
|
0 |
|
|
next_attempt_at |
timestamp(6) with time zone |
yes |
|
|
|
last_status_code |
integer |
yes |
|
|
|
last_error |
character varying(1000) |
yes |
|
|
|
response_snippet |
character varying(500) |
yes |
|
|
|
duration_ms |
bigint |
yes |
|
|
|
created_at |
timestamp(6) with time zone |
|
|
|
|
delivered_at |
timestamp(6) with time zone |
yes |
|
|
|
request_id |
character varying(128) |
yes |
|
|
|
traceparent |
character varying(55) |
yes |
|
|
|
- check
CHECK ((attempts >= 0))
- check
CHECK (((status)::text = ANY ((ARRAY['PENDING'::character varying, 'DELIVERED'::character varying, 'FAILED'::character varying])::text[])))
notification.webhook_inbox_requests
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
inbox_id |
bigint |
|
|
|
notification.webhook_inboxes.id |
received_at |
timestamp(6) with time zone |
|
|
|
|
headers |
character varying(16384) |
|
|
|
|
body |
character varying(16384) |
|
|
|
|
notification.webhook_inboxes
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
token |
character varying(64) |
|
|
unique |
|
username |
character varying(255) |
|
|
|
|
created_at |
timestamp(6) with time zone |
|
|
|
|
notification.webhook_subscriptions
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
identity |
PK |
|
username |
character varying(255) |
|
|
|
|
url |
character varying(2048) |
|
|
|
|
description |
character varying(255) |
yes |
|
|
|
events |
character varying(1000) |
|
|
|
|
secret |
character varying(512) |
|
|
|
|
active |
boolean |
|
true |
|
|
consecutive_failures |
integer |
|
0 |
|
|
disabled_reason |
character varying(500) |
yes |
|
|
|
created_at |
timestamp(6) with time zone |
|
|
|
|
updated_at |
timestamp(6) with time zone |
|
|
|
|
- check
CHECK ((consecutive_failures >= 0))
delivery
Owned by delivery-service: Courier deliveries and their events.
deliveries, delivery_events, event_cursors, processed_events
Migration history: _sqlx_migrations.
delivery.deliveries
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
sequence |
PK |
|
order_id |
bigint |
|
|
unique |
|
username |
text |
|
|
|
|
tracking_code |
text |
|
|
unique |
|
status |
text |
|
|
|
|
attempts |
integer |
|
0 |
|
|
max_attempts |
integer |
|
|
|
|
destination_city |
text |
yes |
|
|
|
destination_zip |
text |
yes |
|
|
|
destination_country |
text |
yes |
|
|
|
paused |
boolean |
|
false |
|
|
script |
text[] |
|
'{}'::text[] |
|
|
discrepancy |
boolean |
|
false |
|
|
next_step_at |
timestamp with time zone |
yes |
|
|
|
created_at |
timestamp with time zone |
|
|
|
|
updated_at |
timestamp with time zone |
|
|
|
|
- check
CHECK ((status = ANY (ARRAY['BOOKED'::text, 'PACKED'::text, 'IN_TRANSIT'::text, 'OUT_FOR_DELIVERY'::text, 'FAILED_ATTEMPT'::text, 'RETURNING'::text, 'DELIVERED'::text, 'RETURNED'::text, 'CANCELLED'::text])))
delivery.delivery_events
| Column |
Type |
Null |
Default |
Key |
References |
id |
bigint |
|
sequence |
PK |
|
delivery_id |
bigint |
|
|
|
delivery.deliveries.id |
status |
text |
|
|
|
|
location |
text |
|
|
|
|
description |
text |
|
|
|
|
actor |
text |
|
|
|
|
source_event_id |
uuid |
yes |
|
|
|
occurred_at |
timestamp with time zone |
|
|
|
|
delivery.event_cursors
| Column |
Type |
Null |
Default |
Key |
References |
consumer |
text |
|
|
PK |
|
last_sequence |
bigint |
|
|
|
|
updated_at |
timestamp with time zone |
|
|
|
|
delivery.processed_events
| Column |
Type |
Null |
Default |
Key |
References |
event_id |
uuid |
|
|
PK |
|
processed_at |
timestamp with time zone |
|
|
|
|