‫Okay, Now that we have our migration, we can go ahead and create our database.
‫So just clean things up at the top and we'll open up the terminal to do this.
‫And we're going to use another net F command.
‫And if we just take a look at the different options we have inside net F, then we've got options to
‫manage the migrations.
‫We use that one to add a new migration, but we've also got options to manage the database itself.
‫And if we go take a look at.
‫The database options and or specify dash H to get some help.
‫Then we could do two things with the database.
‫If we want to get rid of it and delete it.
‫Then we can use the drop command and we can use the updates to update the database to a specified migration.
‫If we don't specify a migration, it's going to take a look inside our migrations folder and apply every
‫migration that we have inside here.
‫As we build our application, we add more entities.
‫Then we're going to create new migrations every time that we want to update the schema of the database.
‫So in this case we want to say dot net if database.
‫Updates.
‫And this is going to go ahead, take a look at the migrations and create the database.
‫Now I get a bunch of information here about what happened there.
‫If you didn't see that level of detail in your terminal.
‫Then that's controlled via the app settings development or JSON.
‫And earlier on, I set this to information to give myself a lot more information about what's happening
‫at the time and if we go back to the terminal.
‫Then we can take a look and see what happened when we ran that command.
‫So inside here, we've got a command to create the table.
‫And this is entity framework using SQL commands to go ahead and do things.
‫So we've got our create table.
‫And then we've got a select and we add a column in here for or a table in here for migration history.
‫And this is how Entity Framework keeps track of which migrations have been applied to a database.
‫And if we had several in there and we just added a new one, then first of all, it goes and checks
‫and then we've got our command to apply our new migration.
‫And we create the users table.
‫And we create the two columns inside that table.
‫And then we insert into our migrations history the migration that's been applied.
‫So how do we go and take a look at a SQLite database?
‫Well, if we take a look at Solution Explorer, then what we'll find is that we have a file in here
‫called Dating App DB.
‫But if we click on it, then Vsco doesn't know what to do with this kind of file.
‫And if you click on Open any way, then you'll probably see some gobbledygook inside your text editor.
‫So I'm not going to do that.
‫But how do we view our database?
‫Well, we can head over to these code extensions once again to get some help in viewing our database.
‫And if we search for SQL Lite, then we're going to get different options of.
‫Things that are SQLite related.
‫I'm going to go for the most popular one in this case, SQL Lite's 1.3 million downloads, and this
‫allows us to explore and query a SQL database.
‫I'm going to go ahead and install this one.
‫And once that's installed, then what this gives us is nothing.
‫At the moment we still can't click on the database file that doesn't do anything for us still.
‫In order to use that extension, we need to go to our command palette.
‫So we'll show all commands.
‫And we're going to search for SQL Lite and we've got an option to open the database, so we'll use that.
‫And then this extension is going to look inside our file system for anything with a DB extension, and
‫we can choose the one that we've just created.
‫And then Inside Solution Explorer.
‫And by the way, this particular extension seems to add some noise into Solution Explorer as well.
‫And these are harmless.
‫They just seem to come along with a SQLite database at the moment.
‫They never used to, but they do now.
‫Please just ignore them.
‫They're not important and it doesn't mean there's anything wrong inside your application.
‫Sometimes you see them there, sometimes you don't.
‫It seems to occur when I open up the SQL Lite Explorer.
‫But in our Solution Explorer, now we've got a SQLite Explorer option and we can see our database.
‫And inside here we can see our two tables, one for the users that has an integer as a column and the
‫username, which is text.
‫And we can see the key symbol next to the ID, which means that's the primary key.
‫We've also got the if migrations history with a couple of columns in there, and if we hit the play
‫button, we'll select what's inside that table and it just gives us our migration ID along with the
‫version of the tool that was used to create it.
‫But just to start us off so that we have something to work with, and this is not the way that we typically
‫add data into our database.
‫We want to add a few test users into this user's table and we can right click on the users and say new
‫query and insert.
‫And then we get the syntax that we need to use to do something with SQL Lite.
‫So we want to insert into the users table and we need to supply the ID and the user name of what we
‫want to insert.
‫So we're just going to manually add this and I'll say value of one and I'll just give a name or username
‫of Bob and then I'll just copy this down two more times just to give us a couple more users to work
‫with.
‫And the second one will specify an idea of two.
‫And this can be Tom.
‫And the idea of three.
‫And this user can be Jane.
‫And in order to run this, we just highlight the text that we're interested in.
‫And then we can say run, selected query.
‫And this goes ahead and adds three new records into our database.
‫But we can confirm that by hitting the play button and taking a look at what's inside this particular
‫table.
‫And we could see our three users inside there.
‫And like I say, that's not how we'd normally add stuff into the database, but we'll look at seeding
‫data a bit later on.
‫But this will give us something to work with for the time being.
‫And what we'll take a look at next is creating our own API controller so that we can query our data
‫using an API endpoint and we'll take a look at that next.