Files
ruoyi-vue-pro/docs/education/migration/03-database-object-mapping.md

9.7 KiB

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.

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: pending migration
  • Required cross-module treatment: System RBAC/DataPermission and tenant configuration are reused; Mall/Pay/Member own commercial primitives; Infra owns secrets/messaging/files where applicable; Education owns only domain relationships and configuration extensions.
  • Risk: High: admin scope, secret leakage, payment configuration, and code redemption errors.
  • Decision still required: Define class/student/teacher scope semantics and separately decide appearance, domain, payment/auth integration, secret, activation-code, coupon, public-bank grant, and marketing ownership or retirement.

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: product decision required
  • Required cross-module treatment: Mall Trade/Product, Pay, Member entitlement/points, CRM, Infra jobs/events/audit; Education owns product-to-education bindings and fulfillment orchestration only.
  • Risk: High financial and authorization risk.
  • Decision still required: Choose entitlement/activation-code/coupon model and confirm issuance, revocation, callback, refund, reconciliation, commission, and referral contracts before paid practice.

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.