Database/Schema Cleanup

Open
#31 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Active
Tech stack
javascript, sqlite
Domain
backend, databases

Research direction

Start by inventorying the schema, database clients, migrations, and seeds under sites/student-site and sites/teacher-site, then review the proposed @autonomy/db package boundary. The issue is an epic with no specific file or sub-issue selected. Done requires an agreed implementation scope covering centralization, multi-tenancy, curriculum versioning, privacy controls, and production database hardening.

Written by the indexing model from the issue text.

Description

enhancement hacktoberfest help wanted

Context & Objectives

The current database schema was rapidly prototyped using LibSQL (Turso) and Drizzle ORM to support initial feature validation. While functional for local testing, the current schema is split across two applications (sites/student-site and sites/teacher-site), lacks relational normalization, exhibits dual-migration drift, and does not support the multi-tenant organizational structure required for deployment in public high schools and CTE districts.

This epic tracks the complete overhaul of the database layer to achieve enterprise readiness, data integrity, FERPA compliance, and support for multi-educator cohort analytics.


Architectural Pillars

  1. Single Source of Truth: Centralize all database definitions, client instances, migrations, and seeds into a shared monorepo package (@autonomy/db).
  2. Educational Multi-Tenancy: Structure data across Districts, Schools, Cohorts (Class Periods), and Enrollments.
  3. Curriculum Immutability & Versioning: Support drafting, publishing, and archiving of curriculum without mutating active student submissions.
  4. Student Psychological Privacy (FERPA / COPPA): Isolate sensitive behavioral self-audits, reflection journals, and restorative practice entries with tenant scoping and audit logging.
  5. Production Engine Hardening: Standardize on UUIDv7 keys, enforce strict foreign key constraints in LibSQL, optimize indexing for query telemetry, and implement reproducible database seeds.

Sub-Issue Breakdown

Dominant language
JavaScript
Stars
2
Forks
2
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from webrune-tim/The-Autonomy-Protocol

All issues in webrune-tim/The-Autonomy-Protocol

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.