Table "cafe.sessions" Column | Type | Collation | Nullable | Default -------------------+--------------------------+-----------+----------+--------------------------- id | uuid | | not null | gen_random_uuid() tenant_id | uuid | | not null | shop_id | uuid | | not null | pos_config_id | integer | | not null | odoo_session_id | integer | | | opened_by_pin_id | uuid | | | opened_by_user_id | uuid | | | opened_at | timestamp with time zone | | not null | CURRENT_TIMESTAMP beginning_cash | numeric(12,2) | | | closed_at | timestamp with time zone | | | closed_by_pin_id | uuid | | | closed_by_user_id | uuid | | | ending_cash | numeric(12,2) | | | ending_bank | numeric(12,2) | | | diff_amount | numeric(12,2) | | | diff_reason_id | uuid | | | state | character varying(20) | | not null | 'open'::character varying display_secret | character varying(64) | | | Indexes: "sessions_pkey" PRIMARY KEY, btree (id) "cafe_sessions_pos_config_state_idx" btree (pos_config_id, state) "cafe_sessions_shop_idx" btree (shop_id) "cafe_sessions_tenant_odoo_session_unique" UNIQUE, btree (tenant_id, odoo_session_id) WHERE odoo_session_id IS NOT NULL "cafe_sessions_tenant_state_idx" btree (tenant_id, state) Foreign-key constraints: "sessions_closed_by_pin_id_foreign" FOREIGN KEY (closed_by_pin_id) REFERENCES commerce.pin_identities(id) ON DELETE SET NULL "sessions_closed_by_user_id_foreign" FOREIGN KEY (closed_by_user_id) REFERENCES tenant_users(id) ON DELETE SET NULL "sessions_diff_reason_id_foreign" FOREIGN KEY (diff_reason_id) REFERENCES cafe.payment_diff_reasons(id) ON DELETE SET NULL "sessions_opened_by_pin_id_foreign" FOREIGN KEY (opened_by_pin_id) REFERENCES commerce.pin_identities(id) ON DELETE SET NULL "sessions_opened_by_user_id_foreign" FOREIGN KEY (opened_by_user_id) REFERENCES tenant_users(id) ON DELETE SET NULL "sessions_shop_id_foreign" FOREIGN KEY (shop_id) REFERENCES commerce.shops(id) ON DELETE CASCADE "sessions_tenant_id_foreign" FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE