Track history of all spool weight/length adjustments with timestamps and comments:
Backend:
- Add SpoolAdjustment database model with spool_id, timestamp, type, value, comment
- Add Alembic migration for spool_adjustment table
- Add SpoolAdjustment Pydantic model for API responses
- Update use_weight, use_length, and measure functions to record adjustments
- Add GET /api/v1/spool/{id}/adjustments endpoint for history retrieval
- Add optional comment parameter to use/measure endpoints
Frontend:
- Add ISpoolAdjustment interface to spool model
- Add collapsible adjustment history table to spool show page
- Display timestamp, type (weight/length), amount, and comment
- Add translation keys for history table
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Migrations
Migrations are used to create and update the database schema. They are run automatically every time Spoolman starts.
To create a new migration, edit the tables as desired in spoolman/database/models.py, then start the Spoolman server to update your local sqlite database.
pdm run python -m spoolman.main
Stop the server once it's up.
Then, let Alembic automatically create a new migration file:
pdm run alembic revision -m "some title" --autogenerate
Go into the created migration and make sure it looks good, that the column changes etc are as desired. Format it with Black and Ruff. Commit.