Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New plays and shots records will need more appropriate merge logic #3

Open
albertlyu opened this issue Apr 27, 2014 · 0 comments
Open

Comments

@albertlyu
Copy link
Owner

The teams, games, and players tables are keyed on ids that come from upstream. This is great for inserting future new records, as the INSERT OR IGNORE INTO logic accounts for duplicates already.

But for plays and shots, primary keys are generated and autoincremented, assuming that inserted records are always new records. This logic is faulty and sloppy at best, will corrupt the tables with duplicate data regularly at worst. We'll need to design a better procedure to handle these tables, perhaps only fetching records based on latest dateYearMonthDay for game_ids in the games table.

Come to think of it, I'm not sure how this will handle players that transfer schools, since the INSERT OR IGNORE statement will attempt to insert a new record, but may be rejected due to a duplicate primary key.

As of now, this issue isn't too outstanding because the 2014-2015 season doesn't begin for another 6 months, so work on the application and client side can commence as we now have a relational database. But this issue will need to be resolved if the application goes into production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant