Repository navigation
Seed built-in exercise catalog - #63
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
Routine creation requires an initial catalog of built-in exercises in every environment. Schema migrations create the exercise table, but a new developer, test environment, or deployment would otherwise start with no selectable exercises.
What changed
0006_seed_builtin_exercises.sql.Why a migration
The built-in catalog is required application reference data rather than optional demo content. Installing it through the normal migration sequence ensures that new developer, test, staging, and production databases receive the same baseline data without requiring a separate seed command that can be forgotten.
Future catalog additions should use new migrations rather than editing this applied migration.
Idempotency
The migration inserts records by stable UUID and uses
ON CONFLICT (id) DO UPDATE. Reapplying its SQL cannot create duplicate built-ins.The update is conditional: it runs only if the ownership marker or canonical name differs. Therefore, repeating the SQL without a real difference does not unnecessarily change
updated_at.The upsert intentionally does not overwrite descriptions, allowing instructional content to be added separately later.
Ownership
Every built-in exercise uses
owner_user_id = NULL, matching the documented ownership model. No custom-user exercises are created.Scope
This PR implements only #62. It does not add descriptions, exercise images, CRUD endpoints, custom exercise creation, routine contracts, or routine UI.
Verification
pnpm --filter @goforlift/api typecheckpnpm --filter @goforlift/api test— 48 tests passedpnpm --filter @goforlift/api lintpnpm --filter @goforlift/api db:generate— no schema changes detectedgit diff --checkThe migration is committed but was not applied to a developer's local PostgreSQL database as part of this PR.
Closes #62