forked from wangziqi/ruoyi-vue-pro
148 lines
13 KiB
Markdown
148 lines
13 KiB
Markdown
# Database Object Mapping
|
||
|
||
> Phase 0 static assessment generated on 2026-07-29. No build, test, application startup, PostgreSQL connection, or Flyway migration was executed during this assessment.
|
||
|
||
> Runtime mapping update 2026-08-01: V4390/EDU-027 owns the native Trade order core, V4400/EDU-028 owns normal-checkout Discount/Reward persistence, V4410/EDU-029 owns delivery, V4420/EDU-030 owns after-sale/log persistence, and V4430/EDU-031 owns brokerage persistence. V4440/EDU-032 adds tenant-composite Seckill tables; V4450/EDU-033 adds tenant-composite `promotion_combination_activity`, `promotion_combination_product`, and `promotion_combination_record` plus tenant-qualified Product, Trade Order, order-record, and head references. The source has neither seckill nor group-buying state, so these tables start empty; its combination-question token stays Education content. Legacy aggregate orders/refunds/campaigns and UUID referral/settlement/proof objects remain unmapped; Bargain/Point and other Promotion tables require dedicated tenant-safe migrations.
|
||
|
||
## Global disposition rules
|
||
|
||
- Ordinary education tables and constraints become immutable module-owned PostgreSQL Flyway migrations.
|
||
- Supabase RLS maps primarily to framework tenant isolation and application authorization, not copied RLS.
|
||
- RPCs/functions map to Java services unless database execution is demonstrably the better boundary.
|
||
- Triggers map to transactions, events, jobs, or audit facilities unless database enforcement is required.
|
||
- Storage maps to Infra File; auth schema maps to Member/System.
|
||
- Current manual SQL is not considered executed or active Flyway history without runtime evidence.
|
||
|
||
## Tenant resolution, identity, and student context
|
||
|
||
### Source and target objects
|
||
|
||
- System tenant and website/domain records are authoritative.
|
||
- Legacy tenant, domain, branding, identity, membership, and RLS objects are reference-only and must not be copied mechanically.
|
||
|
||
### Disposition
|
||
|
||
- **Target owner:** System + Member + framework tenant support with an Education context adapter
|
||
- **Current status:** partially migrated
|
||
- **Required cross-module treatment:** System/framework tenant and security boundaries remain authoritative; Education adapts them. EDU-003 retains generic required `TenantCommonApi` lookup methods and assigns Member-only context enforcement to EDU-004.
|
||
- **Risk:** High: the unauthenticated resolver permits available-tenant existence probing, while wrong authenticated principal/tenant handling can cross security boundaries.
|
||
- **Accepted decision:** Browser headers are forgeable context claims; headless clients use the constrained System-name Public Tenant Handle; unknown/disabled/expired failures are identical. Canonical website values for Public Tenant Resolution are normalized host-only strings. Scheme/path/port-bearing stored values are not silently normalized and require configuration correction. If automated correction is later required, create a separate Flyway/data ticket and invoke `flyway-postgresql`; EDU-003/EDU-004 authorize no database change.
|
||
|
||
## Student core learning loop
|
||
|
||
### Source and target objects
|
||
|
||
- Education catalog and practice/report/idempotency/wrong-question/favorite tables.
|
||
- Verified: native catalog V4020 is a dirty module resource; practice/report/idempotency DDL is currently in untracked sql/postgresql/education files rather than proven active Flyway history.
|
||
|
||
### Disposition
|
||
|
||
- **Target owner:** Education
|
||
- **Current status:** partially migrated
|
||
- **Required cross-module treatment:** Education owns education-domain state and orchestration; Member/System context is reused. Paid/private access remains blocked on an entitlement decision.
|
||
- **Risk:** High: corrupt assessment content, mode-dependent behavior, duplicate state transitions, answer leakage, or unauthorized access.
|
||
- **Decision still required:** Select the pilot-authoritative provider or require a provider-neutral contract; define valid option structure by question type and absent-option semantics; define atomic submit claim/crash recovery; decide entitlement contract before paid/private practice.
|
||
|
||
## Education catalog and question content
|
||
|
||
### Source and target objects
|
||
|
||
- V4020 native catalog tables for regions, schools, majors, subjects, categories, banks, questions, versions, content, collections, blueprints, and bindings.
|
||
- Legacy catalog/question/content/asset tables, constraints, functions, triggers, grants, and RLS are reference objects requiring semantic mapping.
|
||
|
||
### Disposition
|
||
|
||
- **Target owner:** Education
|
||
- **Current status:** partially migrated
|
||
- **Required cross-module treatment:** Education owns domain reads; Infra File may later provide asset transport. No provider expansion should occur before provider authority and graph-integrity rules are decided.
|
||
- **Risk:** High if manual scope is bypassed or invalid cross-tenant/public relationships are admitted.
|
||
- **Decision still required:** Choose Scalar-only, native PostgreSQL, or explicit coexistence; define tenant_id=0 PUBLIC graph semantics and composite-key strategy; decide whether source RLS/functions/triggers are contractual.
|
||
|
||
## Auth, student profile, and extended learning
|
||
|
||
### Source and target objects
|
||
|
||
- Legacy auth/session/verification/OAuth/phone-binding objects.
|
||
- Legacy profile/check-in/points/tasks/exchange/notifications/badges/feedback/exam-countdown objects.
|
||
- Legacy leaderboard/history/report/stats/trend/vocabulary progress/review/favorites/stats objects.
|
||
|
||
### Disposition
|
||
|
||
- **Target owner:** Member + System + Education, with Infra composition
|
||
- **Current status:** pending migration
|
||
- **Required cross-module treatment:** Member/System own authentication and generic membership; Education owns education-specific profile/progress projections. System/Infra may own notifications, while product owners must decide points, badges, feedback, exams, and vocabulary ownership.
|
||
- **Risk:** High for auth compatibility and medium for omitted student progress/profile behavior.
|
||
- **Decision still required:** For every Auth/Profile/extended Learning family, assign Member/System/Education/Infra ownership, compatibility requirement, data disposition, and phase; decide vocabulary, analytics, feedback, exam dates, notifications, points, and badges.
|
||
|
||
## Tenant education operations, appearance, integrations, secrets, and codes
|
||
|
||
### Source and target objects
|
||
|
||
- Legacy classes, student relationships, supervision, roles/configuration, branding/settings/themes, domains, payment accounts, auth-provider configuration, tenant secrets, activation codes, coupons/redemptions, integrations, and marketing objects.
|
||
|
||
### Disposition
|
||
|
||
- **Target owner:** Education + System + Member + Mall/Pay + Infra
|
||
- **Current status:** partially migrated — V4290 owns appearance/settings/theme extensions; V4300 reuses native Pay/System administration; V4310 adds activation-code tables; V4320–V4360 create/adopt native Pay configuration, transaction, Transfer, and Wallet tables plus bounded import audits; V4370 creates native Product; V4380 creates Coupon; V4390–V4430 create tenant-scoped normal Trade order, checkout Promotion, delivery, after-sale/log, and brokerage tables; V4440 creates Seckill tables and V4450 creates Combination activity/product/record tables plus their Trade bridges
|
||
- **Required cross-module treatment:** System RBAC/DataPermission and tenant configuration are reused. Native Pay tables remain Pay-owned and tenant-aware. Native Product tables remain Mall-owned, all nine records use `TenantBaseDO`, and composite tenant references protect the catalog graph. Native Promotion Coupon, Seckill, and Combination tables remain Mall-owned and tenant-qualified; Product validates SPU/SKU scope, Member supplies principals, and Trade owns order lifecycle. V4330 stores digests/mapping notes but no credentials. Tenant-scoped `system_social_client` remains System-owned. Global `system_sms_channel` is not a safe substitute for tenant PNVS. Education owns resource binding and entitlement state; activation-code rows store digest/mask, never plaintext.
|
||
- **Risk:** High: admin scope, secret leakage, payment configuration, promotion stock, and code redemption errors.
|
||
- **Decision still required:** Domains stay in System. EDU-021–EDU-033 resolve bounded Pay/Product/Coupon/normal-Trade/delivery/after-sale/native-brokerage/Seckill/Combination activation. Decide Bargain/Point and other Promotion families, explicit legacy product/code-coupon/order/refund/referral/settlement-proof import, production export/runbooks, Member mapping and reviewed opening balances, non-equivalent providers, fulfillment/refund revocation, legacy activation-code import, tenant PNVS, encrypted generic private secrets, public-bank grants, and other marketing as separate contracts.
|
||
|
||
## Platform administration and governance
|
||
|
||
### Source and target objects
|
||
|
||
- Legacy platform staff, tenant lifecycle/billing profiles, public question-bank grant/sync, SaaS plan/invoice/usage/overage/dunning, audit/export/alert/notification-channel, and permission objects.
|
||
|
||
### Disposition
|
||
|
||
- **Target owner:** System + Pay + Mall + Infra + CRM with Education extensions
|
||
- **Current status:** pending migration
|
||
- **Required cross-module treatment:** System, Pay, Mall, Infra, CRM, and Education-specific extension permissions; Education must not duplicate platform ledgers or generic administration.
|
||
- **Risk:** High access-control and financial-governance risk.
|
||
- **Decision still required:** Define separate Student App, Tenant Admin, Platform Admin, public, and internal policies; map each platform surface to System/Pay/Mall/Infra/CRM/Education or explicit retirement.
|
||
|
||
## Commercialization and growth
|
||
|
||
### Source and target objects
|
||
|
||
- Legacy product/order/payment/event/entitlement/coupon/refund/reconciliation/commission/referral/points/dunning objects.
|
||
- Target Mall/Pay/Member tables remain authoritative; Education may add minimal binding records.
|
||
|
||
### Disposition
|
||
|
||
- **Target owner:** Mall + Pay + Member + CRM with Education binding
|
||
- **Current status:** partially migrated — product binding, entitlement events, activation-code redemption, native Pay ledgers/import, Product/Coupon, and V4390–V4450 normal Trade order/checkout/delivery/after-sale/brokerage/Seckill/Combination persistence/UI are implemented; explicit legacy product/code-coupon/order/refund/referral/settlement-proof import, Bargain/Point and other Promotion families, production bulk migration, and broader commerce orchestration remain open
|
||
- **Required cross-module treatment:** Mall Trade/Product/Promotion, Pay transaction/callback APIs, Member entitlement/points, CRM, Infra jobs/events/audit; Education owns product-to-education bindings and fulfillment orchestration only. Legacy financial rows may enter Pay only through EDU-023's reviewed aggregate contract; incompatible legacy code campaigns may not be silently copied into native coupon instances.
|
||
- **Risk:** High financial and authorization risk.
|
||
- **Decision still required:** Keep activation codes as Education learning credentials and coupons/seckill as Mall Promotion objects; native Trade owns new two-level commissions and special-order order fields, while other Promotion families, source CRM referral and settlement-proof import, automatic issuance, revocation callbacks, refunds, and reconciliation require separate contracts before broader paid-practice fulfillment.
|
||
|
||
## Background processing, assets, and operational platform
|
||
|
||
### Source and target objects
|
||
|
||
- Legacy worker queues, leases, retries/dead letters, imports/exports, reconciliation, notification/audit, usage, and security scan state.
|
||
- Target owns business state in domain modules and uses platform execution primitives; do not copy queue tables wholesale.
|
||
|
||
### Disposition
|
||
|
||
- **Target owner:** Infra platform plus owning domain modules
|
||
- **Current status:** partially migrated
|
||
- **Required cross-module treatment:** Infra Job/MQ/File/logging/observability plus owning Education/Pay/Mall/CRM handlers; scanner deployment or adapter ownership must be decided.
|
||
- **Risk:** High operational and security risk.
|
||
- **Decision still required:** Confirm Infra claim/lease semantics and scanner ownership, file privacy/retention, legacy asset migration/re-scan, and duplicate-safe at-least-once processing.
|
||
|
||
## Secondary learning, media, AI, and engagement
|
||
|
||
### Source and target objects
|
||
|
||
- Legacy scoreline, vocabulary, handbook, video entitlement/progress, recommendation, notification, badge, exam-date, and analytics objects.
|
||
|
||
### Disposition
|
||
|
||
- **Target owner:** Education plus AI/Infra/Member/System
|
||
- **Current status:** product decision required
|
||
- **Required cross-module treatment:** AI, Infra File/messaging, Member growth primitives, System notifications, and Education extensions.
|
||
- **Risk:** Medium-to-high due to entitlement, media access, sensitive reporting, and unclear scope.
|
||
- **Decision still required:** For each capability, assign Education, existing platform ownership, explicit retirement, or later product scope; decide entitlement and safe export/redaction requirements.
|