hmacphail / pokemon-evolution

0 stars 0 forks source link

Best way to store learnsets in DB #27

Open hmacphail opened 6 years ago

hmacphail commented 6 years ago

Split learnsets into two tables. New pokemonLearnsets table has 1:M relation with both learnsets and pokemon tables.

gameId, genId, and pokemonId all moved to pokemonLearnsets.

hmacphail commented 6 years ago

when adding new learnset:

look for learnset in learnsets table... get id or make new one

if learnset not new, look for learnset/pokemon relationship in this table... change generation range if gameId = null else... create 1 entry in this table, for game, pokemon, generation

have to retrieve learnset every time new one is made to get id for this table (maybe on-the-fly within pokemon movesByLevel loop)

hmacphail commented 6 years ago

Promise loop for learnsets: https://stackoverflow.com/questions/24660096/correct-way-to-write-loops-for-promise https://stackoverflow.com/questions/40328932/javascript-es6-promise-for-loop https://caolan.github.io/async/