Harimaki Database

Relationships between Harimaki students, work, classes, and subscriptions.

Created ~10 min explore

Proposed model · 14 November 2026

One account, one learning history, several sources of access. This design is based on the monetization notes. Harimaki has a Turso connection; the application tables, authentication model, and billing described here are proposed and have not been implemented.

How to read the ERD

Each box is an entity. Lines describe relationships rather than a sequence of steps. PK = primary key, FK = foreign key, UK = unique key. Nullable attributes may be empty. Each diagram presents a view of the same model. The relationship symbols below explain the marks at each end of a line.

Use two-finger scrolling to pan, pinch to zoom, or Fit diagram to see the overview. On touch screens, expand a diagram first to pan and zoom it; inline, swipes scroll the page.

Relationship symbols

These are crow’s foot symbols. A mark beside an entity tells you how many rows of that entity can relate to one row at the other end. A circle means zero is allowed, a bar means one, and the three-pronged foot means many. Combine the marks to read the minimum and maximum together.

Exactly one (1)
A related row is required, and there can be only one.
Diagram notation: ||
Zero or one (0..1)
The relationship is optional, with at most one related row.
Diagram notation: o|
One or more (1..*)
At least one related row is required; there can be many.
Diagram notation: |{
Zero or more (0..*)
There may be no related rows or any number of related rows.
Diagram notation: o{

The symbols mirror when drawn at the opposite end: o{ and }o both mean zero or many. Read both ends to understand the full relationship. “Many” sets no maximum; application quotas are a separate rule.

One-to-one
user ||..o| user_settings
A user can have zero or one settings row. Each settings row belongs to exactly one user. This model makes settings optional with a unique user_id.
One-to-many
user ||..o{ analysis
A user can own zero or many analyses. Each analysis has exactly one owner. The crow’s foot is beside analysis because that is the many side.
Many-to-one
analysis }o..|| user
Many analyses can belong to one user. This is the same ownership relationship read from the other side; it does not need another table or foreign key.
Many-to-many
user }o..o{ "class"
For student membership, a user can join many classes and a class can have many students. This is a conceptual relationship: class_member stores the links as two one-to-many relationships.

How the membership link works. Each class_member row points to one user and one class. Several rows allow a student to join several classes, or a class to contain several students. The unique class_id and student_user_id pair prevents duplicate membership. The class’s teacher is a separate relationship.

A dotted line means a non-identifying relationship: the foreign key is not part of the child row’s primary key. A solid line means an identifying relationship, where the parent’s key forms part of the child’s primary key. Dotted lines do not mean optional; the circle at the endpoint determines that. The current model uses dotted lines.

Identity and learning

The account stays the same when plans change. Documents, answers, and mastery remain with the student.

Identity and learning diagram
Rendering diagram…
  • Authentication entities are provisional. The Turso connection exists, but these tables are not implemented.
  • The teaching diagram shows assignment_id relationships for analysis and attempt. Independent work leaves this field empty.
  • Learning materials and questions stay in the repository. content_key, test_key, and question_key are logical references, without foreign keys to content tables.

Subscriptions and payments

The beneficiary, billing user, and actual transaction payer have distinct relationships.

Subscriptions and payments diagram
Rendering diagram…
  • Rina is the beneficiary of her personal plan. A parent can pay without automatically gaining access to Rina's work.
  • Budi is the beneficiary of the Tutor plan. Rina accesses his assignments through class membership, without copying his subscription.
  • Free access is the baseline and needs no paid subscription row. Plan definitions, quotas, and permission checks live in application policy.
  • Cancellation stops renewal; access continues through the paid period. Transaction history does not grant permission to read student work.

Classes and assignments

Teachers assign work. Students retain ownership and share submissions within the class.

Classes and assignments diagram
Rendering diagram…
  • A student can join several classes while paying for a personal plan. Accounts and learning history are not duplicated.
  • Server checks match the student, class, assignment type, and active coverage. A foreign key alone does not grant access or bypass quotas.
  • Expiry preserves classes and work. Leaving a class ends access through that membership while preserving personal history.

One student, two sources of access

Rina has a Student subscription and joins Budi’s physics class, covered by his Tutor plan.

Both plans active
Rina uses personal features and completes class assignments. Budi can only review work shared through the class.
Rina’s plan expires
Independent practice returns to free limits. Class assignments continue while her membership and Budi’s coverage remain active.
Budi’s plan expires
Rina’s personal plan remains active. Class assignments become read-only; Budi cannot create assignments or receive new submissions.
Both plans expire
Owners can still read and download their documents and results. New activity follows free limits.
Rina leaves the class
Rina keeps her personal plan and work. Class-based access and ongoing teacher review through that membership end.
Quota exceeded
Existing work is preserved. Additional storage is restricted until usage falls within the allowance or coverage resumes.

Overlapping access does not automatically add quotas together. Paying for a plan does not grant access to private work. Cancellation stops renewal; access is downgraded when the paid period ends. Reactivation restores features without resetting history. Deletion for inactivity requires a separate retention policy.

Implementation order

  1. Establish identity and ownership, then complete a MAKI workflow that students can save and reopen.
  2. Add test evidence, bookmarks, topic mastery, and upload metadata as real workflows need them.
  3. Validate the Student offer, then add subscriptions, payments, and centralized access checks.
  4. Add classes, memberships, and assignments when teachers need those workflows.

Organizations, centers with multiple teachers, guardian permissions, and tutoring bookings are future extensions. Prices and quotas in the monetization notes remain assumptions, not production configuration.