So let's set up the rest of our migrations and what do we want to do first?
Well, we've done the users table.
Let's do the reservations table, so fire up a terminal window.
So to generate fears, create reserve stations, table.
This name can be whatever you want, but I like to make mine descriptive, so it creates that perfect.
So we now I'm going to copy the user's table just to make this faster and go to the up migration for
create reservations table.
And I still want to have better put the correct table name in here.
That'll be reservations.
I want an ID.
What else do we need?
We need first name, last name, email and phone.
And those are all of our so first name and last name.
I already have email or you have.
Let's create a phone and I will allow phone to be empty by putting in a default value of an empty string.
So that gets us email and phone, start date, end date and remedy.
Start date and end date.
Well let's try this.
This will be a start date.
It's a type date and it has nothing in here, no defaults and then end date.
And that has nothing in the defaults, are there, but I better put the closing curly bracket in there
or I'll get an error.
What else do we have?
Remedy created and updated.
And all I need to worry about is remedy, because fizz or soda will take care of these two for me.
So real money and this will be room ID int.
And that should be enough.
So let's try running that migration so to my right, see if we got it right and we did all right.
So I now have my reservations table.
What's next?
Let's go back and have a look here at our structure.
Next is rooms.
So let's create a migration for rooms so I'll clear the screen.
So to generate figures and we'll call this one Create Rooms table and it creates the file once again
just to make things faster.
I will copy this and use that for my rooms table up.
And this is called Rooms and it has an ID.
What else does it have?
Room name and is created an updated us.
And this one's really easy.
It's just real name.
And I should be able to run that migration, so to my great.
And there's rooms that are do our downs now.
Last time we did our down for the user table by using raw squat drop table users and there's other ways
of doing this.
You can actually do it like this drop table.
And the name of the migration I want to do, which is reservations in this case.
And that does exactly the same thing, all that fizz does or sort of does is look at the command drop
table, look at the table, and it builds a circle for you.
So I'm going to copy that and put the same for the down migration.
Four rooms.
OK, so we have now we've done let's go back to her description of our database, we've done users,
we've done Rum's, we've done reservations.
Let's do restrictions next.
Open up my command prompt, clear the screen so to generate fears, create restrictions table, and
it creates those once again I'll copy one of my existing up scripts just to make it simpler and I'll
open the up script for this.
The table name is restrictions and in that table and restrictions I have an ID which is easy, a restriction
name and a created out and updated out.
So I just need restriction in.
Restriction name, save that, run the migration, so to migrate, there's my restrictions table and
now we have room restrictions.
So let's do that one next.
So to generate fears, create room restrictions, table, and I'll copy one that is already here.
So this one is as good as any copy that and put it into my restrictions.
Table up pasted in.
Call it room restrictions.
And what do we have in that table?
We have ID start date and date.
OK, so start date and they already have those so I can delete these ones, save some typing so I'd
start date and date remedy the remedy.
We already have a remedy.
I left that would there by just lucky happenstance reservation it.
So I'll duplicate this one and make that a reservation id reservation spelled right.
OK.
And created an updated and restriction.
So restriction.
And I don't care about creating an updated app because those are added automatically.
Actually technically I could leave it out as well because fizbo will add that for me, but I like to
put it in there.
I don't know what.
Let's run our migrations.
So to migrate, they're all there now.
Let's make sure we get our down migrations.
So here's a down that I used already for rolls.
I'll copy that.
And here's the down for restrictions, which is restrictions, table restrictions, and here's the one
for room restrictions, room restrictions.
So if all that.
Well, I should when I go back to my database and this time I'm going to use I'm going to use postdoc,
which is just a different client.
It's just faster than ever.
And I'll go to my localhost and look for bookings and there are all of my tables.
So if I look at restrictions, there's the correct format for excellent.
And if I look at rooms, has all the correct columns great.
And there are lots of clients out there.
I just use post right now because it refreshes so much faster than ever.
I'm sure you've noticed that although it is a functional tool and it does everything you want it to
do, it can be a little slow and a little awkward.
Postdoc was actually a very good tool.
It's a commercial tool, but there is a trial available in.
The trial doesn't expire.
It just has a few limitations.
But for the purposes of this course, if you happen to be on a Mac, you might want to search for post
Toco posted SEO and use that instead.
It's entirely up to you and it's certainly not required anyway.
We have our database set up.
The last thing I want to add is foreign keys and that may require that we change some of the columns,
but that's easy enough.
So we'll take care of setting up our foreign keys in the next lecture and then our database is ready
to go and we can start the process of connecting our go code to the database.