Giao diện
Kiểu dữ liệu & quy ước
Trang sinh tự động
Sinh từ ad83b0aea — chạy 820 migration lên PostgreSQL 17 rồi đọc pg_catalog. Không sửa tay: lần chạy docgen sau sẽ ghi đè.
Không dùng enum của PostgreSQL
Schema có 0 kiểu enum. Trạng thái được biểu diễn bằng domain có CHECK hoặc CHECK trực tiếp trên bảng (1.429 check constraint), vì thêm một giá trị vào enum cần ALTER TYPE còn sửa CHECK thì không khoá bảng lâu.
Domain type (8)
| Kiểu | Kiểu nền | Ràng buộc | Mô tả |
|---|---|---|---|
ordering.cancel_reason | text | CHECK ((VALUE = ANY (ARRAY['OUT_OF_STOCK'::text, 'DEPOSIT_TIMEOUT'::text, 'CAMPAIGN_FAILED'::text, 'MOQ_FAILED'::text, 'CUSTOMER_CANCEL'::text, 'DEPOSIT_UNPAID_AT_CLOSE'::text, 'DELIVERY_FAILED'::text]))) | U19-P1-07 Word closed list of Da huy; G1S-P0-03 + DEPOSIT_UNPAID_AT_CLOSE (TB-04); #479 + DELIVERY_FAILED (giao hàng thất bại: failed cycles + skips over "Được bỏ qua tối đa", Mất cọc). |
ordering.order_axis | text | CHECK ((VALUE = ANY (ARRAY['INITIATED'::text, 'CONFIRMED'::text, 'SUCCESS'::text, 'PARTIAL_SUCCESS'::text, 'FAILED'::text, 'CANCELLED'::text, 'RETURNED'::text]))) | U19-P1-07 Word order axis; #479 + PARTIAL_SUCCESS (Thành công một phần: a Mua định kỳ order ended with delivered cycles and at least one cycle cancelled for a failed delivery). |
ordering.payment_axis | text | CHECK ((VALUE = ANY (ARRAY['UNPAID'::text, 'DEPOSIT_PAID'::text, 'PAID'::text, 'DEPOSIT_FORFEITED'::text, 'WAITING_REFUND_REQUEST'::text, 'WAITING_REFUND'::text, 'REFUNDED'::text, 'PARTIALLY_REFUNDED'::text, 'RETURN_NO_REFUND'::text]))) | U19-P1-07 Word payment axis; #479 B + RETURN_NO_REFUND (Không hoàn tiền (hoàn hàng): a unit paid in full was returned, Operations recorded that nothing is refunded). |
ordering.shipping_axis | text | CHECK ((VALUE = ANY (ARRAY['NOT_PROCESSED'::text, 'WAITING_PACKING'::text, 'PACKING'::text, 'PACKED'::text, 'SHIPPING'::text, 'WAITING_REDELIVERY'::text, 'DELIVERED'::text, 'DELIVERY_FAILED'::text, 'RETURNED'::text]))) | |
public.app_code | text | CHECK ((VALUE = ANY (ARRAY['APP_USER'::text, 'APP_SALE'::text, 'WEB_ADMIN'::text]))) | |
public.correlation_ref | text | CHECK ((VALUE ~ '^[A-Za-z0-9._-]{8,64}$'::text)) | |
public.mission_metric | text | CHECK ((VALUE = ANY (ARRAY['DELIVERED_ORDER_COUNT'::text, 'DELIVERED_ORDER_VALUE'::text, 'RECURRING_CYCLE_DELIVERED_COUNT'::text, 'REFERRAL_SIGNUP_EKYC_COUNT'::text, 'REFERRAL_FIRST_PAID_ORDER_COUNT'::text, 'AFFILIATE_QUALIFIED_ORDER_COUNT'::text, 'AFFILIATE_QUALIFIED_BASE_VALUE'::text, 'PROFILE_VERIFICATION_COMPLETED'::text]))) | MT-01 catalog v1 (sow/12). *_VALUE metrics are integer VND; PROFILE_VERIFICATION_COMPLETED is a boolean step (one unit); every other metric counts distinct sources (one unit each). |
public.phone_e164 | text | CHECK ((VALUE ~ '^\+[1-9][0-9]{6,14}$'::text)) CHECK (((VALUE !~ '^\+84'::text) OR (VALUE ~ '^\+84[1-9][0-9]{8}$'::text))) |
Composite type (7)
Dùng làm kiểu trả về của hàm SQL trả nhiều cột.
| Kiểu | Mô tả |
|---|---|
catalog.product_history_row | |
mission.progress_row | |
payment.checkout_state | |
payment.checkout_tender | |
payment.intent_change | P3-02. What one runtime step did to an intent (and its order): outcome + before/after versions for the outbox. |
report.source_row | |
sale_profile.change_row |
Collation
| Collation | Locale | Dùng cho |
|---|---|---|
catalog.name_order | vi | sắp xếp tiếng Việt A-Z |
Extension (7)
| Extension | Phiên bản | Schema |
|---|---|---|
btree_gist | 1.7 | extensions |
citext | 1.6 | extensions |
pg_trgm | 1.6 | extensions |
pgcrypto | 1.3 | extensions |
plpgsql | 1.0 | pg_catalog |
unaccent | 1.1 | extensions |
uuid-ossp | 1.1 | extensions |
Role
| Role | Đăng nhập | Bỏ qua RLS | Vai trò |
|---|---|---|---|
anon | ✗ | ✗ | stub Supabase |
authenticated | ✗ | ✗ | stub Supabase |
pi_api | ✗ | ✗ | Edge Function graphql — đường request |
pi_auth | ✗ | ✗ | Edge Function auth — danh tính |
pi_rbac_operator | ✗ | ✗ | operator bootstrap RBAC |
pi_worker | ✗ | ✗ | Edge Function jobs — job định kỳ |
service_role | ✗ | ✓ | stub Supabase |
View
Schema có 0 view. Mọi phép đọc đi qua hàm SQL, không qua view.