54 lines
2.2 KiB
Markdown
54 lines
2.2 KiB
Markdown
---
|
|
# nuzlocke-tracker-vc5o
|
|
title: Seed moves and abilities tables (names + introduced generation)
|
|
status: completed
|
|
type: task
|
|
priority: normal
|
|
created_at: 2026-03-20T15:11:44Z
|
|
updated_at: 2026-03-20T15:25:11Z
|
|
parent: nuzlocke-tracker-neqv
|
|
---
|
|
|
|
Create and seed `moves` and `abilities` tables with name and generation data using the hybrid approach.
|
|
|
|
## Approach
|
|
Seed move/ability **names** with `introduced_gen` only. Full generation-specific stats (power, accuracy, type changes, effect text) will be added in a follow-up bean.
|
|
|
|
This enables FK references and autocomplete from boss pokemon fields without blocking on a full moves database.
|
|
|
|
## Checklist
|
|
- [x] **Migration**: Create `moves` table (`id`, `name`, `introduced_gen`, `type` optional)
|
|
- [x] **Migration**: Create `abilities` table (`id`, `name`, `introduced_gen`)
|
|
- [x] **Models**: Create `Move` and `Ability` SQLAlchemy models
|
|
- [x] **Seed data**: Seed all move names with introduced generation (source: PokeAPI or Bulbapedia)
|
|
- [x] **Seed data**: Seed all ability names with introduced generation
|
|
- [x] **Seed script**: Add to existing seeding pipeline (`backend/src/app/seed/`)
|
|
- [x] **Schemas**: Create basic response schemas for API consumption
|
|
|
|
## Summary of Changes
|
|
|
|
### Migration
|
|
- Created `j1e2f3a4b5c6_add_moves_and_abilities_tables.py` migration
|
|
- `moves` table: `id`, `name` (unique), `introduced_gen`, `type` (optional)
|
|
- `abilities` table: `id`, `name` (unique), `introduced_gen`
|
|
- Added indexes on `introduced_gen` for both tables
|
|
|
|
### Models
|
|
- `backend/src/app/models/move.py`: `Move` SQLAlchemy model
|
|
- `backend/src/app/models/ability.py`: `Ability` SQLAlchemy model
|
|
- Updated `models/__init__.py` to export both
|
|
|
|
### Schemas
|
|
- `backend/src/app/schemas/move.py`: `MoveResponse`, `AbilityResponse`, and paginated variants
|
|
- Updated `schemas/__init__.py` to export all new schemas
|
|
|
|
### Seed Data
|
|
- Created `backend/scripts/fetch_moves_abilities.py` to fetch data from PokeAPI
|
|
- Generated `moves.json` (937 moves) and `abilities.json` (367 abilities)
|
|
- Data includes name, introduced generation, and type (for moves)
|
|
|
|
### Seed Pipeline
|
|
- Added `upsert_moves` and `upsert_abilities` functions to `loader.py`
|
|
- Updated `run.py` to seed moves and abilities after Pokemon
|
|
- Updated `verify()` to include move/ability counts
|