Skip to content

Conversation

@ZeyadAbbas
Copy link
Contributor

Closes #45

What changed

  • File table

    • Split metadata: added fileTitle, fileName
    • Added publishDate, edited flag, likes, saves, createdAt, editedAt
    • Enforced nonnegative counters with CHECKs
    • Author FK now cascades on delete, section FK sets null
    • Unique index on (authorId, fileTitle)
    • Indexes on authorId, sectionId, publishDate
    • Kept id as nanoid(20) varchar
  • Section table

    • Introduced prefix, number, sectionCode, term enum, year, professor, numberOfNotes
    • Added createdAt and updatedAt
    • New primary key format: id is nanoid(6) varchar
    • Composite uniqueness on (prefix, number, sectionCode, term, year)
    • Indexes for common filters: by course, professor, semester

Rationale

  • Faster lookups and deduping with explicit indexes and composite unique keys
  • Better UX for listing and searching files and sections
  • Safer counters via CHECK constraints

Migration notes

  • Section id changed from text(20) to varchar(6). Existing data will need a mapping:
    1. Create new section ids and a mapping table old_id -> new_id
    2. Update file.section_id using the mapping
    3. Drop old constraints and recreate with new types

How I tested

  • Generated and applied Drizzle migrations locally

@vercel
Copy link

vercel bot commented Oct 27, 2025

@ZeyadAbbas is attempting to deploy a commit to the Nebula Labs Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Nov 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
utd-notebook Ready Ready Preview Comment Nov 5, 2025 1:39am

@ShriramJana ShriramJana merged commit 6f2c850 into UTDNebula:develop Nov 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updating Section and Files DB Table Schemas

2 participants