Importing DTO to Database and/or creating schema
Closed this issue · 6 comments
More of a question than an issue but I assume that someone here might be able to guide me a bit.
I'm using Laravel and writing an application to parse and display a bunch of stats for a summoner. My issue is getting the information contained in the DTO created by LeagueWrap into my database. Is there an automated way of setting up a database schema (migration) or do I have to map it out my hand? For an average game there's a lot of data fields to map and while I guess I could do it by hand it seems like a lot of work.
Along those same lines, would it be easier to work with JSON data? If so, is there an easy way to convert the DTO generated by LeagueWrap to JSON?
Sorry, new-ish to PHP and Laravel.
I'll be using MySQL.
Simplest problem: I'm not sure how to best store the data your wrapper provides in my database.
It all depends on what you want to store (and analyze), sometimes it isn't necessary to store the whole json response, but only parts of it. Laravel's Eloquent supports MySQL, Postgres, MSSQL and SQLite I believe, but there are packages that add additional driver support for example for MongoDB. If you have any more questions feel free to post on the Riot Dev forums or on the Discord channel.
These responses were not helpful in the least. For the sake of example let's say I make this call to the API:
$match = $api->match()->match(1399898747);
I want to store everything it returns in a MySQL database. How do I go about doing that? Do I need a pre-definded database schema based around the data that my API call will return or can I automate that process since any call for match information will essentually return the same type of data.