Skip to content

Add core routines table - #57

Merged
rd-code-23 merged 1 commit into
mainfrom
feature/routines-schema
Aug 24, 2026
Merged

rd-code-23 merged 1 commit into
mainfrom
feature/routines-schema

Conversation

@rd-code-23

Copy link
Copy Markdown
Owner

Problem

GoForLift needs a persistent user-owned routine record before ordered exercise configuration, schedules, APIs, or routine UI can be implemented.

What changed

  • Added the Drizzle routines table schema.
  • Exported the table from the complete database schema index.
  • Generated migration 0003_overrated_nightshade.sql.
  • Added the generated Drizzle snapshot and journal entry.
  • Documented each column's product responsibility in the schema.

Table design

The table contains:

  • id: generated UUID primary key
  • user_id: required foreign key to the registered owner
  • name: required user-visible routine name
  • description: optional routine notes
  • created_at and updated_at: timezone-aware timestamps with defaults

Every routine must have an owner. The foreign key uses PostgreSQL's default NO ACTION behavior, so a user cannot be deleted while routines still reference that user. This avoids silently cascading routine deletion before account-deletion behavior has been deliberately designed.

An index on user_id supports the initial authorized query pattern: list routines belonging to the current user. No speculative uniqueness constraint was added because users may reasonably create routines with the same name.

Scope

This PR implements only #56.

Out of scope:

  • routine exercises
  • routine schedules
  • API contracts and endpoints
  • routine UI
  • guest persistence
  • dashboard integration

Migration verification

Drizzle detected the expected routines shape: six columns, one index, and one foreign key. A second generation reported No schema changes, nothing to migrate, confirming the schema and metadata are consistent.

Verification

  • pnpm --filter @goforlift/api typecheck
  • pnpm --filter @goforlift/api test — 48 tests passed
  • pnpm --filter @goforlift/api lint
  • Prettier checks for changed schema and generated metadata
  • git diff --check

The migration is committed but was not applied to a developer's local PostgreSQL database as part of this PR.

Closes #56

@rd-code-23
rd-code-23 merged commit 8b8df23 into main Aug 24, 2026
1 check 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.

[Routines][Phase 1] Implement core routines table

1 participant