OK, now, look, we've got a migration, what we can do next is actually go ahead and update our database.
So what we'll do is we'll just go back to our terminal window and I'll just clear the contents of this
screen.
And in order to create our database, we can once again use the dot net F tools.
And this time the command that we're going to use is the dot net database and then updates and press
return.
And he goes ahead and creates our database now we can see what's going on here.
And just to point something out here, by the way, what this does this command before it goes ahead
and does the database creation, it builds on application.
And if you get an error such as build fails, please make sure you've stopped your API from running
before you try and do this for a while.
You get an error and it's not very descriptive.
So first of all, it builds our application and then it goes ahead and reads from our migration's and
it creates our table.
Or first of all, it creates a table called If Migration's History.
This keeps track of the migrations that have been applied into our database.
And then if we scroll further down, we can see that it creates a table called users and it's got two
columns, the ID and the username.
And then it inserts a record into the F Migration's history database with the name of the migration,
along with the runtime that was used when creating that particular migration or division of the entity
framework tools, I should say.
So how do we go and check physically to see that we've got a school like database?
Well, what we can use is we'll head back to the passcode extensions and this time we'll use scorelines.
This visual studio users, right?
Users, you'll have your own tools to manage the database and for the code, we just need to install
and extra at all.
This tool is fine.
You've got various different options.
But this one called scorelines is sufficient for what we need inside here.
So I'm just going to go ahead and install this and then I'm just going to close all.
And what we can do then is open up the command palette once again and we can use the scroll lights and
say open database.
And then it's going to look inside our project.
It's going to find the database file that was created when we created our database.
And we could select that.
And if we go and take a look at our project files, what we'll find is that, well, it's actually created
three files, the dating app DB and a couple of SQLite extras that we don't need to look at.
But they're there anyway, so don't worry about those.
But Inside Solution Explorer, we've got the sequel Light Explorer and we can see our database and we
can see our table for our users with an ID field and a username and also the EAF migration history.
So we've got some data to work with.
What we'll do is we'll use this tool to insert some data into our database.
We'll look at more sophisticated ways of getting data into our database a bit later on.
But in order to keep things simple and to keep us moving, we're just going to use this method to insert
some data.
So what we're going to do right is right, click the user's table and say new query inserts and then
we can literally write sequel commands to get some data in.
And what we'll do is we'll insert into our users table and we'll just give it an idea of one.
And we'll just add a couple of usernames inside there and we'll add, Bob, as one user will add, Tom
as a second user.
And we'll just copy this command a third time.
And will add a value of three and we'll specify, Jane, as the third user inside here, and then what
we can do is just highlight all of this code, right?
Click and say run selected query.
And this goes ahead and executes these commands and updates our database.
And what we should find is we can close this down.
We don't need that anymore.
But what we should find if we write, click and shootable, we now see that we've got three different
records in our database.
We've got Bob, Tom and Jane, along with the three IDs as well.
So we've now got data in our database, but we'll take a look at next is creating an API controller
so that we can fetch the records out of this database and send those that data back to the client.