Repository navigation
Add routine schedules table - #61
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Routines may optionally be planned for recurring days and local times, but the persistence model did not yet have a schedule record. Scheduling must represent user intent without prematurely introducing time-zone conversion, notifications, or calendar infrastructure.
What changed
routine_schedulestable.0005_freezing_siren.sqland its Drizzle metadata.docs/database.md.Table design
Each schedule record contains:
The day convention is Sunday
0through Saturday6, matching JavaScript'sDate#getDay()convention. PostgreSQL enforces the allowed0–6range.local_timeusesTIME(0)without a time-zone offset because it represents recurring local intent, such as Monday at 6:00 PM, rather than an absolute moment. Time-zone storage and notification conversion remain intentionally out of scope.Integrity and deletion behavior
A unique
(routine_id, day_of_week, local_time)index rejects duplicate schedule entries and supports loading schedules by routine through its leading routine column.Deleting a routine cascades to its schedule entries because those entries have no meaning without their parent routine.
Scope
This PR implements only #60. It does not add notifications, user time zones, one-off calendar dates, schedule endpoints, routine UI, or dashboard integration.
Migration verification
Drizzle detected six tables and the expected schedule shape: six columns, one index, and one foreign key. A second generation reported
No schema changes, nothing to migrate.Verification
pnpm --filter @goforlift/api typecheckpnpm --filter @goforlift/api test— 48 tests passedpnpm --filter @goforlift/api lintgit diff --checkThe migration is committed but was not applied to a developer's local PostgreSQL database as part of this PR.
Closes #60