feat: add migration framework with FastMigrate integration

- Add migrations.py with create_migration, run_migrations, get_db_version
- Implement CLI migrate and create-migration commands
- Use FastMigrate's sequential 0001-*.sql naming convention
- Add comprehensive unit, integration, and E2E tests (35 tests)
- Add fresh_db_path and temp_migrations_dir test fixtures

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-27 18:25:28 +00:00
parent 32bb3c01e0
commit 7d7cd2bb57
6 changed files with 756 additions and 11 deletions

10
PLAN.md
View File

@@ -24,11 +24,11 @@ Check off items as completed. Each phase builds on the previous.
- [x] **Commit checkpoint** (d8910d6)
### Step 1.3: Migration Framework
- [ ] Create `migrations.py` using FastMigrate patterns
- [ ] Create `cli.py` with `migrate` and `create-migration` commands
- [ ] Create initial migration for `schema_migrations` table
- [ ] Write tests for migration discovery and application
- [ ] **Commit checkpoint**
- [x] Create `migrations.py` using FastMigrate patterns
- [x] Create `cli.py` with `migrate` and `create-migration` commands
- [x] Create initial migration for `schema_migrations` table
- [x] Write tests for migration discovery and application
- [x] **Commit checkpoint**
### Step 1.4: Reference Tables Schema
- [ ] Create migration for species, locations, products, feed_types, users tables