1
00:00:00,900 --> 00:00:05,280
So let's set up the rest of our migrations and what do we want to do first?

2
00:00:05,820 --> 00:00:07,130
Well, we've done the users table.

3
00:00:07,320 --> 00:00:10,910
Let's do the reservations table, so fire up a terminal window.

4
00:00:11,430 --> 00:00:19,910
So to generate fears, create reserve stations, table.

5
00:00:20,010 --> 00:00:24,390
This name can be whatever you want, but I like to make mine descriptive, so it creates that perfect.

6
00:00:24,780 --> 00:00:31,560
So we now I'm going to copy the user's table just to make this faster and go to the up migration for

7
00:00:31,560 --> 00:00:32,970
create reservations table.

8
00:00:33,630 --> 00:00:37,650
And I still want to have better put the correct table name in here.

9
00:00:37,650 --> 00:00:39,090
That'll be reservations.

10
00:00:39,630 --> 00:00:40,600
I want an ID.

11
00:00:40,680 --> 00:00:41,420
What else do we need?

12
00:00:42,450 --> 00:00:44,660
We need first name, last name, email and phone.

13
00:00:44,790 --> 00:00:47,340
And those are all of our so first name and last name.

14
00:00:47,340 --> 00:00:49,320
I already have email or you have.

15
00:00:49,980 --> 00:00:59,700
Let's create a phone and I will allow phone to be empty by putting in a default value of an empty string.

16
00:01:00,330 --> 00:01:04,200
So that gets us email and phone, start date, end date and remedy.

17
00:01:04,200 --> 00:01:05,740
Start date and end date.

18
00:01:05,760 --> 00:01:06,780
Well let's try this.

19
00:01:09,770 --> 00:01:10,800
This will be a start date.

20
00:01:12,140 --> 00:01:18,500
It's a type date and it has nothing in here, no defaults and then end date.

21
00:01:21,990 --> 00:01:26,550
And that has nothing in the defaults, are there, but I better put the closing curly bracket in there

22
00:01:26,580 --> 00:01:27,670
or I'll get an error.

23
00:01:28,530 --> 00:01:29,450
What else do we have?

24
00:01:30,240 --> 00:01:32,430
Remedy created and updated.

25
00:01:32,430 --> 00:01:36,830
And all I need to worry about is remedy, because fizz or soda will take care of these two for me.

26
00:01:37,170 --> 00:01:41,460
So real money and this will be room ID int.

27
00:01:43,850 --> 00:01:45,010
And that should be enough.

28
00:01:45,870 --> 00:01:53,730
So let's try running that migration so to my right, see if we got it right and we did all right.

29
00:01:53,740 --> 00:01:55,890
So I now have my reservations table.

30
00:01:55,920 --> 00:01:56,720
What's next?

31
00:01:57,750 --> 00:02:01,140
Let's go back and have a look here at our structure.

32
00:02:01,920 --> 00:02:03,050
Next is rooms.

33
00:02:03,060 --> 00:02:07,530
So let's create a migration for rooms so I'll clear the screen.

34
00:02:07,860 --> 00:02:18,960
So to generate figures and we'll call this one Create Rooms table and it creates the file once again

35
00:02:18,960 --> 00:02:20,130
just to make things faster.

36
00:02:20,130 --> 00:02:24,300
I will copy this and use that for my rooms table up.

37
00:02:25,590 --> 00:02:28,090
And this is called Rooms and it has an ID.

38
00:02:28,110 --> 00:02:29,070
What else does it have?

39
00:02:30,510 --> 00:02:32,670
Room name and is created an updated us.

40
00:02:32,680 --> 00:02:33,600
And this one's really easy.

41
00:02:33,720 --> 00:02:35,370
It's just real name.

42
00:02:39,620 --> 00:02:44,570
And I should be able to run that migration, so to my great.

43
00:02:46,010 --> 00:02:48,530
And there's rooms that are do our downs now.

44
00:02:48,550 --> 00:02:55,310
Last time we did our down for the user table by using raw squat drop table users and there's other ways

45
00:02:55,310 --> 00:02:55,870
of doing this.

46
00:02:55,880 --> 00:02:59,300
You can actually do it like this drop table.

47
00:03:00,230 --> 00:03:03,860
And the name of the migration I want to do, which is reservations in this case.

48
00:03:05,960 --> 00:03:11,870
And that does exactly the same thing, all that fizz does or sort of does is look at the command drop

49
00:03:11,870 --> 00:03:14,460
table, look at the table, and it builds a circle for you.

50
00:03:14,570 --> 00:03:18,770
So I'm going to copy that and put the same for the down migration.

51
00:03:18,770 --> 00:03:19,850
Four rooms.

52
00:03:21,430 --> 00:03:27,580
OK, so we have now we've done let's go back to her description of our database, we've done users,

53
00:03:27,580 --> 00:03:29,590
we've done Rum's, we've done reservations.

54
00:03:29,980 --> 00:03:31,390
Let's do restrictions next.

55
00:03:34,350 --> 00:03:44,460
Open up my command prompt, clear the screen so to generate fears, create restrictions table, and

56
00:03:44,460 --> 00:03:50,950
it creates those once again I'll copy one of my existing up scripts just to make it simpler and I'll

57
00:03:50,970 --> 00:03:52,440
open the up script for this.

58
00:03:52,740 --> 00:04:01,110
The table name is restrictions and in that table and restrictions I have an ID which is easy, a restriction

59
00:04:01,110 --> 00:04:02,790
name and a created out and updated out.

60
00:04:02,790 --> 00:04:03,960
So I just need restriction in.

61
00:04:06,280 --> 00:04:15,460
Restriction name, save that, run the migration, so to migrate, there's my restrictions table and

62
00:04:15,460 --> 00:04:17,380
now we have room restrictions.

63
00:04:17,380 --> 00:04:18,700
So let's do that one next.

64
00:04:22,460 --> 00:04:34,280
So to generate fears, create room restrictions, table, and I'll copy one that is already here.

65
00:04:34,550 --> 00:04:39,410
So this one is as good as any copy that and put it into my restrictions.

66
00:04:39,410 --> 00:04:41,790
Table up pasted in.

67
00:04:42,350 --> 00:04:44,560
Call it room restrictions.

68
00:04:45,980 --> 00:04:47,070
And what do we have in that table?

69
00:04:47,900 --> 00:04:49,690
We have ID start date and date.

70
00:04:49,700 --> 00:04:57,560
OK, so start date and they already have those so I can delete these ones, save some typing so I'd

71
00:04:57,560 --> 00:05:00,410
start date and date remedy the remedy.

72
00:05:00,560 --> 00:05:01,630
We already have a remedy.

73
00:05:01,640 --> 00:05:05,960
I left that would there by just lucky happenstance reservation it.

74
00:05:06,110 --> 00:05:13,520
So I'll duplicate this one and make that a reservation id reservation spelled right.

75
00:05:13,590 --> 00:05:13,990
OK.

76
00:05:14,780 --> 00:05:17,180
And created an updated and restriction.

77
00:05:17,540 --> 00:05:18,310
So restriction.

78
00:05:22,220 --> 00:05:26,030
And I don't care about creating an updated app because those are added automatically.

79
00:05:26,030 --> 00:05:30,770
Actually technically I could leave it out as well because fizbo will add that for me, but I like to

80
00:05:30,770 --> 00:05:31,310
put it in there.

81
00:05:31,340 --> 00:05:32,150
I don't know what.

82
00:05:33,170 --> 00:05:34,580
Let's run our migrations.

83
00:05:34,850 --> 00:05:39,020
So to migrate, they're all there now.

84
00:05:39,020 --> 00:05:41,060
Let's make sure we get our down migrations.

85
00:05:41,060 --> 00:05:43,620
So here's a down that I used already for rolls.

86
00:05:43,700 --> 00:05:44,540
I'll copy that.

87
00:05:44,960 --> 00:05:53,960
And here's the down for restrictions, which is restrictions, table restrictions, and here's the one

88
00:05:53,960 --> 00:05:59,000
for room restrictions, room restrictions.

89
00:05:59,930 --> 00:06:00,710
So if all that.

90
00:06:00,710 --> 00:06:06,350
Well, I should when I go back to my database and this time I'm going to use I'm going to use postdoc,

91
00:06:06,350 --> 00:06:07,700
which is just a different client.

92
00:06:07,730 --> 00:06:09,290
It's just faster than ever.

93
00:06:09,740 --> 00:06:14,690
And I'll go to my localhost and look for bookings and there are all of my tables.

94
00:06:15,050 --> 00:06:18,950
So if I look at restrictions, there's the correct format for excellent.

95
00:06:19,580 --> 00:06:22,910
And if I look at rooms, has all the correct columns great.

96
00:06:23,450 --> 00:06:25,220
And there are lots of clients out there.

97
00:06:25,220 --> 00:06:29,100
I just use post right now because it refreshes so much faster than ever.

98
00:06:29,120 --> 00:06:32,870
I'm sure you've noticed that although it is a functional tool and it does everything you want it to

99
00:06:32,870 --> 00:06:36,980
do, it can be a little slow and a little awkward.

100
00:06:37,010 --> 00:06:38,540
Postdoc was actually a very good tool.

101
00:06:38,540 --> 00:06:41,120
It's a commercial tool, but there is a trial available in.

102
00:06:41,120 --> 00:06:42,410
The trial doesn't expire.

103
00:06:42,410 --> 00:06:43,850
It just has a few limitations.

104
00:06:44,000 --> 00:06:48,860
But for the purposes of this course, if you happen to be on a Mac, you might want to search for post

105
00:06:48,860 --> 00:06:53,060
Toco posted SEO and use that instead.

106
00:06:53,300 --> 00:06:57,260
It's entirely up to you and it's certainly not required anyway.

107
00:06:57,260 --> 00:06:58,760
We have our database set up.

108
00:06:59,150 --> 00:07:04,760
The last thing I want to add is foreign keys and that may require that we change some of the columns,

109
00:07:04,760 --> 00:07:05,630
but that's easy enough.

110
00:07:05,870 --> 00:07:11,030
So we'll take care of setting up our foreign keys in the next lecture and then our database is ready

111
00:07:11,030 --> 00:07:15,530
to go and we can start the process of connecting our go code to the database.
