Pokémon Data (CSV Format)
This directory contains Pokémon data in CSV format for easy editing and maintenance.
File Structure
/data/pokemon/
├── gen1-kanto.csv # Gen 1 Pokémon (Kanto region, #1-151)
├── gen2-johto.csv # Gen 2 Pokémon (Johto region, #152-251) - Future
├── gen3-hoenn.csv # Gen 3 Pokémon (Hoenn region, #252-386) - Future
├── games.csv # All Pokémon games definitions
└── README.md # This file
CSV Format
gen{N}-{region}.csv
One CSV file per generation/region containing all Pokémon from that generation.
Columns:
pokedexNumber- National Pokédex number (e.g., 1, 25, 151)name- Pokémon name (e.g., Bulbasaur, Pikachu, Mew)form- Form name (empty for base form, "Female" for gender differences, "Alolan" for regional forms, etc.)games- Pipe-separated list of games where this Pokémon can be caught (e.g., "Red|Blue|Yellow")regionalNumber- Regional Pokédex number for base forms (empty for gender/alternative forms)
Example (gen1-kanto.csv):
pokedexNumber,name,form,games,regionalNumber
1,Bulbasaur,,Red|Blue|Yellow|LG: Pikachu|LG: Eevee,1
3,Venusaur,,Red|Blue|Yellow|LG: Pikachu|LG: Eevee,3
3,Venusaur,Female,Red|Blue|Yellow|LG: Pikachu|LG: Eevee,
25,Pikachu,,Red|Blue|Yellow|LG: Pikachu|LG: Eevee,25
151,Mew,,Red|Blue|Yellow,151
games.csv
Defines all Pokémon games.
Columns:
id- Unique game identifier (lowercase, hyphenated, e.g., "red", "lg-pikachu")displayName- Display name for the game (e.g., "Red", "LG: Pikachu")region- Region/generation the game belongs to (e.g., "Kanto", "Johto")generation- Generation number (1-9)
Example:
id,displayName,region,generation
red,Red,Kanto,1
blue,Blue,Kanto,1
lg-pikachu,LG: Pikachu,Kanto,7
Editing with Excel/Google Sheets
CSV files are designed to be edited in spreadsheet applications:
- Open the CSV file in Excel or Google Sheets
- Use formulas, sorting, and filtering for bulk operations
- Save as CSV when done
Example workflows:
Adding a new game to existing Pokémon
Find & Replace in the games column:
- Find:
Red|Blue - Replace:
Red|Blue|NewGame
Adding a new Pokémon
Add a new row with all required fields:
152,Chikorita,,Gold|Silver|Crystal,1
Adding a regional form
Add a new row with the form name:
19,Rattata,Alolan,Sun|Moon|US|UM,
Generating SQL Migrations
After editing CSV files, generate SQL migrations using npm scripts:
# Generate migration for Kanto
npm run seed:kanto
# Generate migration for Johto (when ready)
npm run seed:johto
# Custom region
npm run seed:generate <RegionName>
Generated migrations will be created in /supabase/migrations/ with timestamp prefixes.
Testing Changes
After generating a migration:
# Reset local database to test
npm run supabase:reset
# Verify the changes loaded correctly
Important Notes
-
Regional Numbers: Only base forms (no
formvalue) should haveregionalNumbervalues. Forms like "Female" or "Alolan" should leave this column empty. -
Game Names: Must exactly match the
displayNameingames.csv. Use pipe|as separator, no spaces around pipes. -
National Dex Numbers: Must be accurate. Gender forms and regional variants share the same
pokedexNumberas their base form. -
CSV Encoding: Save files with UTF-8 encoding to support special characters.
-
Quotes: Only use quotes around values containing commas. Excel/Google Sheets handles this automatically.
Common Operations
Add a new generation (e.g., Gen 2 - Johto)
- Create
gen2-johto.csvwith the format above - Add Johto games to
games.csv - Run
npm run seed:johto - Test with
npm run supabase:reset
Add a new game to existing generation
- Open
games.csv, add new game row - Open the relevant
gen{N}-{region}.csvfile - Use Find & Replace to add the new game to the
gamescolumn - Regenerate the migration:
npm run seed:{region} - Test with
npm run supabase:reset
Add DLC/expansion Pokémon
- Add new Pokémon rows to the appropriate generation CSV
- Update the
gamescolumn with the DLC games - Regenerate the migration
- Test
Database Schema
Generated migrations insert data into two tables:
pokedex_entries: Pokémon species data (name, form, games, etc.)regional_dex_numbers: Regional Pokédex numbers (separate table for scalability)
This design allows adding new regions without database schema changes.