1
00:00:05,400 --> 00:00:08,200
In the last video, we created a simple class

2
00:00:08,200 --> 00:00:10,270
that can store itself into a database

3
00:00:10,270 --> 00:00:12,710
and also initialise itself from the database

4
00:00:12,710 --> 00:00:17,010
if that database exists and the data is in the table.

5
00:00:17,010 --> 00:00:20,550
So, we should now have a few records in our accounts table

6
00:00:20,550 --> 00:00:24,050
and up until now we used the sqlite command line interface

7
00:00:24,050 --> 00:00:25,800
to view our database.

8
00:00:25,800 --> 00:00:27,720
Now it's important to know how to do that

9
00:00:27,720 --> 00:00:30,000
and also how to use the SQL commands,

10
00:00:30,000 --> 00:00:31,430
but now that we're back in IlelliJ,

11
00:00:31,430 --> 00:00:34,120
there's actually an easy way to database view,

12
00:00:34,120 --> 00:00:36,730
so we're gonna be talking about that in this video.

13
00:00:36,730 --> 00:00:38,720
Now I've closed the run window from the last video

14
00:00:38,720 --> 00:00:40,470
because we're gonna need the space

15
00:00:40,470 --> 00:00:42,740
and if you haven't already done it,

16
00:00:42,740 --> 00:00:45,670
split line five like I've done here over two lines,

17
00:00:45,670 --> 00:00:47,500
because that will actually get rid of one of the warnings

18
00:00:47,500 --> 00:00:49,250
over here in the right hand side,

19
00:00:49,250 --> 00:00:51,120
but I've already done that so consequentially,

20
00:00:51,120 --> 00:00:53,290
I haven't actually got that warning.

21
00:00:53,290 --> 00:00:56,510
Now, each line of SQL though, if we have a look at it

22
00:00:56,510 --> 00:00:58,790
and just come over here, has basically got the same

23
00:00:58,790 --> 00:01:00,970
error message, "No data sources are configured

24
00:01:00,970 --> 00:01:02,690
"to run this SQL."

25
00:01:02,690 --> 00:01:04,720
And you can see there's a few there.

26
00:01:04,720 --> 00:01:07,390
And also down here, there's one.

27
00:01:08,540 --> 00:01:11,430
And as I said in the last video, that's not a warning

28
00:01:11,430 --> 00:01:15,250
about our pathing code, it's IntelliJ advising us

29
00:01:15,250 --> 00:01:17,370
that it could check our SQL statements for us

30
00:01:17,370 --> 00:01:20,040
if we configured a data source.

31
00:01:20,040 --> 00:01:21,880
So what we're gonna do is start by opening

32
00:01:21,880 --> 00:01:25,050
the Database Tool window, we can go down or up I should say

33
00:01:25,050 --> 00:01:28,550
to View, Tool Windows and select Database.

34
00:01:33,590 --> 00:01:35,590
I could also have clicked on Database over here

35
00:01:35,590 --> 00:01:38,040
on the right hand side.

36
00:01:38,040 --> 00:01:41,210
Now from here what we can do is create a data source.

37
00:01:41,210 --> 00:01:43,540
We can do that with Control End or Command End,

38
00:01:43,540 --> 00:01:45,160
depending on your operating system,

39
00:01:45,160 --> 00:01:48,380
alternatively we can just click on this little plus,

40
00:01:48,380 --> 00:01:49,640
on the top left here.

41
00:01:49,640 --> 00:01:51,270
But the other way of doing it is just to drag

42
00:01:51,270 --> 00:01:53,790
the database file into the window.

43
00:01:53,790 --> 00:01:55,460
Now this only works if the file has got

44
00:01:55,460 --> 00:01:59,850
the correct extension, now IntelliJ uses the Windows system

45
00:01:59,850 --> 00:02:02,660
where the file extension determines the type of the file.

46
00:02:02,660 --> 00:02:04,860
And that's why it was important to give the database

47
00:02:04,860 --> 00:02:08,910
a .sqlite extension, even on Linus or OSX.

48
00:02:08,910 --> 00:02:11,070
Those two operating systems don't use file extensions

49
00:02:11,070 --> 00:02:13,360
in the same way, but IntelliJ

50
00:02:13,360 --> 00:02:15,670
does rely on them on all platforms.

51
00:02:15,670 --> 00:02:17,990
So what we can do is over here is, we can drag on

52
00:02:17,990 --> 00:02:22,130
this accounts.sqlite and drag it and drop it

53
00:02:22,130 --> 00:02:25,470
into the Database pane and you can see when I did that

54
00:02:25,470 --> 00:02:27,750
we've now got an entry showing.

55
00:02:27,750 --> 00:02:30,420
And I'll just move this over a little bit.

56
00:02:30,420 --> 00:02:32,630
So, now that I've done that, you can see that

57
00:02:32,630 --> 00:02:34,550
some of the errors have disappeared,

58
00:02:34,550 --> 00:02:35,990
but we've still got some other ones here,

59
00:02:35,990 --> 00:02:38,730
one "Unable to resolve column 'balance'",

60
00:02:38,730 --> 00:02:39,910
but the ones that have disappeared

61
00:02:39,910 --> 00:02:43,890
are the ones relating to creation of the tables.

62
00:02:43,890 --> 00:02:46,250
The reason that it's disappeared is that

63
00:02:46,250 --> 00:02:48,970
IntelliJ now knows the names of the tables

64
00:02:48,970 --> 00:02:51,790
and actually recognises the data source.

65
00:02:51,790 --> 00:02:53,700
Now we still got warnings, as I mentioned,

66
00:02:53,700 --> 00:02:55,980
that we can't resolve the column names

67
00:02:55,980 --> 00:02:57,280
and that's because InelliJ doesn't have

68
00:02:57,280 --> 00:03:00,370
the correct driver for sqlite databases.

69
00:03:00,370 --> 00:03:01,880
So the first time you do this, you'll need

70
00:03:01,880 --> 00:03:05,660
to instal the drivers for whichever database you're using.

71
00:03:05,660 --> 00:03:08,060
And that's why accounts in the Database window

72
00:03:08,060 --> 00:03:10,150
is underlined as you can see here.

73
00:03:10,150 --> 00:03:13,980
And if I hover over it, you can see we've got a message

74
00:03:13,980 --> 00:03:17,350
"Can't find the driver, open preferences to download".

75
00:03:17,350 --> 00:03:19,230
So we're gonna right click on this database now

76
00:03:19,230 --> 00:03:21,060
and select Properties.

77
00:03:23,380 --> 00:03:24,560
And there is a link down here where it says

78
00:03:24,560 --> 00:03:29,330
Download missing driver files, so click on that.

79
00:03:29,330 --> 00:03:30,810
And hopefully you can see that it's downloaded

80
00:03:30,810 --> 00:03:33,090
the relevant files for us automatically

81
00:03:33,090 --> 00:03:34,920
and I can click on OK.

82
00:03:36,790 --> 00:03:38,330
And you can see the errors have now disappeared,

83
00:03:38,330 --> 00:03:40,330
the warnings rather have disappeared,

84
00:03:40,330 --> 00:03:42,610
the underline on accounts has disappeared

85
00:03:42,610 --> 00:03:46,800
and IntelliJ is now fully aware of the data source

86
00:03:46,800 --> 00:03:50,620
and as well as the tables and columns within that.

87
00:03:50,620 --> 00:03:53,920
All right, so I just wanna show you a quick slide here,

88
00:03:53,920 --> 00:03:56,030
if you're using Windows, because this step

89
00:03:56,030 --> 00:04:00,200
you might actually get a Windows Security Alert popup.

90
00:04:01,080 --> 00:04:02,950
So this is the dialogue that I'm talking about

91
00:04:02,950 --> 00:04:05,150
and again, this is only a Windows thing,

92
00:04:05,150 --> 00:04:09,050
so you may actually get this popup on your computer.

93
00:04:09,050 --> 00:04:12,420
So if you do get that, it's important

94
00:04:12,420 --> 00:04:15,390
to allow access on private networks.

95
00:04:15,390 --> 00:04:17,190
So righter strangely, the dialogue appears

96
00:04:17,190 --> 00:04:19,339
with Public networks already ticked

97
00:04:19,339 --> 00:04:21,130
and you probably don't want to allow that.

98
00:04:21,130 --> 00:04:23,290
So Untick Pulic networks and make sure

99
00:04:23,290 --> 00:04:25,730
you tick Private networks before clicking

100
00:04:25,730 --> 00:04:27,750
the Allow access button, so I'm just gonna bring

101
00:04:27,750 --> 00:04:29,210
that on the screen again while I'm talking

102
00:04:29,210 --> 00:04:32,500
just so you can see that image, if you don't allow access

103
00:04:32,500 --> 00:04:34,870
on Private networks, you'll get all sorts of problems

104
00:04:34,870 --> 00:04:38,880
with updates and so forth, so again, what we need to do here

105
00:04:38,880 --> 00:04:43,070
if Public networks is ticked and you do get this dialogue,

106
00:04:43,070 --> 00:04:44,490
you probably don't want to allow that,

107
00:04:44,490 --> 00:04:46,890
so you untick Public networks and make sure

108
00:04:46,890 --> 00:04:48,920
you tick Private networks before clicking

109
00:04:48,920 --> 00:04:50,990
on the Allow access button.

110
00:04:50,990 --> 00:04:52,460
All right, so back to the slide.

111
00:04:52,460 --> 00:04:54,900
So notice that this dialogue may appear again,

112
00:04:54,900 --> 00:04:58,070
after a Java update, so it is a persistent setting,

113
00:04:58,070 --> 00:05:00,830
but a new of Java will trigger it again.

114
00:05:00,830 --> 00:05:03,520
And again, this is only a Windows thing.

115
00:05:03,520 --> 00:05:05,760
Okay, so now that we've got the right drivers,

116
00:05:05,760 --> 00:05:08,820
the warnings disappear and IntelliJ can verify

117
00:05:08,820 --> 00:05:10,410
our table and column names as you can see.

118
00:05:10,410 --> 00:05:13,290
So that's pretty cool, but it does actually get better.

119
00:05:13,290 --> 00:05:17,930
And I'm just gonna expand this out a little bit again.

120
00:05:17,930 --> 00:05:20,260
And if we now expand this, we can see that

121
00:05:20,260 --> 00:05:22,990
it's showing us helpfully the list of tables

122
00:05:22,990 --> 00:05:24,860
and we can expand those further and actually see

123
00:05:24,860 --> 00:05:27,870
the columns within tables and note that

124
00:05:27,870 --> 00:05:31,900
for the transactions table, time is showing as TEXT

125
00:05:31,900 --> 00:05:34,210
rather than TIMESTAMP and you'll only see

126
00:05:34,210 --> 00:05:37,940
the normal sqlite types when you the schema this way,

127
00:05:37,940 --> 00:05:40,740
so it's not actually perfect, you do have to take care

128
00:05:40,740 --> 00:05:43,280
if you modify any nonstandard columns from here,

129
00:05:43,280 --> 00:05:44,660
but it's still a very useful feature

130
00:05:44,660 --> 00:05:46,900
and makes life a lot easier.

131
00:05:46,900 --> 00:05:49,750
Now you can also double click on the table names

132
00:05:49,750 --> 00:05:53,160
or use the Table Editor button on the toolbar,

133
00:05:53,160 --> 00:05:54,510
which is this button here, which is greyed out,

134
00:05:54,510 --> 00:05:57,800
because I haven't selected a table.

135
00:05:57,800 --> 00:06:00,320
Clicking on that actually gives us a list

136
00:06:00,320 --> 00:06:03,090
of entries that are actually in the database.

137
00:06:03,090 --> 00:06:05,090
Or specifically in that table.

138
00:06:05,090 --> 00:06:07,000
And up here, you've actually got an entry

139
00:06:07,000 --> 00:06:08,490
where you can actually add a new row

140
00:06:08,490 --> 00:06:10,940
and because we've got accounts open,

141
00:06:10,940 --> 00:06:13,860
this toolbar is relating to the accounts table,

142
00:06:13,860 --> 00:06:15,450
we can actually add a new record if we want,

143
00:06:15,450 --> 00:06:19,190
so I click on that and double click into the record,

144
00:06:19,190 --> 00:06:21,630
or into the column rather, enter a new name

145
00:06:21,630 --> 00:06:25,120
say Michael, I can tab or double click on the balance

146
00:06:25,120 --> 00:06:28,700
and let's put in 500, press enter there.

147
00:06:28,700 --> 00:06:31,230
So we add another record, we need another Terry,

148
00:06:31,230 --> 00:06:34,310
so let's double click type Terry in here,

149
00:06:34,310 --> 00:06:37,310
and and we put in an amount of zero.

150
00:06:38,340 --> 00:06:39,980
Now we get an error or rather,

151
00:06:39,980 --> 00:06:42,740
we should get an error but we don't yet.

152
00:06:42,740 --> 00:06:44,770
Now note that the two new entries

153
00:06:44,770 --> 00:06:47,780
are highlighted in green here, we've added the rows

154
00:06:47,780 --> 00:06:49,900
but the change hasn't been commuted to the database,

155
00:06:49,900 --> 00:06:51,480
that's why it's in green.

156
00:06:51,480 --> 00:06:54,210
So two buttons have become available up here on the toolbar

157
00:06:54,210 --> 00:06:56,490
and they're quite small though so might have to

158
00:06:56,490 --> 00:06:58,810
sort of squinch your eyes to see them.

159
00:06:58,810 --> 00:07:01,050
So I've got this one here, which is gonna be Submit

160
00:07:01,050 --> 00:07:04,500
and we've got this one here which is Revert.

161
00:07:04,500 --> 00:07:07,340
And notice that it wasn't active, the Revert button

162
00:07:07,340 --> 00:07:11,000
until I selected a record, so if I've got Terry selected

163
00:07:11,000 --> 00:07:15,920
clicking on Revert once removes and if I click on it again

164
00:07:15,920 --> 00:07:19,190
that's removed Michael as well and it's now disabled

165
00:07:19,190 --> 00:07:21,720
because of course everything's been commuted to the database

166
00:07:21,720 --> 00:07:24,120
and there's nothing to update or revert.

167
00:07:24,120 --> 00:07:28,290
All right, so we're gonna add those two entries again.

168
00:07:31,230 --> 00:07:34,070
Michael, 500 and also Terry, zero.

169
00:07:39,740 --> 00:07:42,830
This time I'm gonna submit the change

170
00:07:42,830 --> 00:07:44,990
and notice we've got an error down the bottom.

171
00:07:44,990 --> 00:07:46,820
Abort due to constraint violation

172
00:07:46,820 --> 00:07:49,950
(UNIQUE constraint failed: accounts.name)

173
00:07:49,950 --> 00:07:52,180
So why are we actually getting this error?

174
00:07:52,180 --> 00:07:54,950
Well, it's because the name column is the primary key

175
00:07:54,950 --> 00:07:57,980
and primary key fields have to be unique.

176
00:07:57,980 --> 00:07:59,690
And right down the bottom of the screen you can see

177
00:07:59,690 --> 00:08:01,970
that it's even showing you the SQL that

178
00:08:01,970 --> 00:08:05,640
it was trying to use to add these records to the database,

179
00:08:05,640 --> 00:08:08,070
So in this case it's failed, again, because of

180
00:08:08,070 --> 00:08:12,230
the unique constraint as duplicating the name Terry.

181
00:08:13,970 --> 00:08:15,750
So let's go ahead and make this new Terry unique,

182
00:08:15,750 --> 00:08:20,310
so I'll put Terry and we'll put TerryG there this time.

183
00:08:20,310 --> 00:08:23,080
And if I submit this time, you'll see

184
00:08:23,080 --> 00:08:26,990
that it worked successfully and the entries are no longer

185
00:08:26,990 --> 00:08:28,620
in green which tells us that they've been actually

186
00:08:28,620 --> 00:08:30,450
added to the database.

187
00:08:32,020 --> 00:08:35,030
At this point I can't then Revert the change

188
00:08:35,030 --> 00:08:36,299
and just to show you something here, if I change

189
00:08:36,299 --> 00:08:39,460
this TerryG to TerryH, whoops, TerryH,

190
00:08:45,460 --> 00:08:48,220
we can then revert that change if we want to.

191
00:08:48,220 --> 00:08:50,330
Now on some operating systems you may get

192
00:08:50,330 --> 00:08:53,020
something weird happen here, sometimes you might find

193
00:08:53,020 --> 00:08:56,720
that the Revert button doesn't get enabled

194
00:08:56,720 --> 00:08:58,260
and what you may have to do is click on

195
00:08:58,260 --> 00:09:01,030
this little circular arrow thing here

196
00:09:01,030 --> 00:09:03,280
to actually refresh the table and then you'll find

197
00:09:03,280 --> 00:09:05,010
that you'll be able to use the revert button.

198
00:09:05,010 --> 00:09:07,410
But as you see it didn't occur on my Mac,

199
00:09:07,410 --> 00:09:10,630
but it may occur on Windows or Linux sometimes,

200
00:09:10,630 --> 00:09:14,990
I believe it's possibly a bug with IntelliJ.

201
00:09:14,990 --> 00:09:18,890
Right so, at this point now, we've actually got an account

202
00:09:18,890 --> 00:09:21,940
for each member of my department and that's really

203
00:09:21,940 --> 00:09:24,870
the IntelliJ Database Viewer in a nutshell.

204
00:09:24,870 --> 00:09:28,560
Now you can actually use this Database Viewer

205
00:09:28,560 --> 00:09:30,960
to view a range of different databases

206
00:09:30,960 --> 00:09:32,470
and obviously you can't drag things like

207
00:09:32,470 --> 00:09:34,750
Microsoft SQL Server databases into the window

208
00:09:34,750 --> 00:09:37,110
to configure it, so if that's the case

209
00:09:37,110 --> 00:09:38,740
and you want to do that, you come up here

210
00:09:38,740 --> 00:09:42,070
and you click on plus, the top left of the Database window

211
00:09:42,070 --> 00:09:43,990
and you choose the Data Source that you want,

212
00:09:43,990 --> 00:09:46,390
Data Source, you can see there's quite a few there,

213
00:09:46,390 --> 00:09:48,200
and you select the appropriate database type

214
00:09:48,200 --> 00:09:50,050
from the listing, configure your connexion.

215
00:09:50,050 --> 00:09:54,480
So for example you if I choose SQL Server (Microsoft)

216
00:09:54,480 --> 00:09:56,830
we have the usual configuration options for

217
00:09:56,830 --> 00:09:59,360
connecting to a SQL server database.

218
00:09:59,360 --> 00:10:01,400
Now if you've never used SQL server, don't worry about it,

219
00:10:01,400 --> 00:10:03,470
I'm just showing you what's possible,

220
00:10:03,470 --> 00:10:06,680
if you do need to connect to a SQL Server or Oracle

221
00:10:06,680 --> 00:10:09,400
or DB2 or whatever, the database admins will

222
00:10:09,400 --> 00:10:12,120
give you the details to enter into this form anyway.

223
00:10:12,120 --> 00:10:15,460
All right, so I'm gonna Cancel this.

224
00:10:15,460 --> 00:10:17,080
All right, so there's one more thing that I wanna cover

225
00:10:17,080 --> 00:10:20,170
before we move on, now we're going to be looking at

226
00:10:20,170 --> 00:10:23,260
committing and rolling back database transactions.

227
00:10:23,260 --> 00:10:26,320
But we've also got a table called transactions

228
00:10:26,320 --> 00:10:29,820
that stores data of financial transactions.

229
00:10:29,820 --> 00:10:31,850
Now using the same word for both of these things

230
00:10:31,850 --> 00:10:35,020
is going to get confusing very quickly.

231
00:10:35,020 --> 00:10:36,520
So what we're going to do is rename

232
00:10:36,520 --> 00:10:39,370
our transactions table to history.

233
00:10:39,370 --> 00:10:41,310
Now renaming tables and columns is something

234
00:10:41,310 --> 00:10:43,270
you may need to do, which is why

235
00:10:43,270 --> 00:10:47,270
I've contrived to this excuse to show you how to do it.

236
00:10:47,270 --> 00:10:48,690
So firstly, I want to close down

237
00:10:48,690 --> 00:10:52,270
this Database Viewer window for accounts

238
00:10:52,270 --> 00:10:55,160
to go back to our code and I'm gonna close down

239
00:10:55,160 --> 00:10:56,910
the database for now.

240
00:11:00,970 --> 00:11:02,930
So the first thing we need to do is to make a change

241
00:11:02,930 --> 00:11:05,580
to the code so that we don't go creating

242
00:11:05,580 --> 00:11:09,030
a new row for Terry, so we come down here,

243
00:11:09,030 --> 00:11:11,120
on line 53, and we're gonna make

244
00:11:11,120 --> 00:11:14,530
that Account equals TerryG, instead of Terry,

245
00:11:14,530 --> 00:11:17,670
so we avoid any problems with violating

246
00:11:17,670 --> 00:11:20,350
the unique constraint and the other thing I wanna do

247
00:11:20,350 --> 00:11:22,950
is now retrieve those two entries,

248
00:11:22,950 --> 00:11:26,770
actually we'll change that to TerryJ,

249
00:11:26,770 --> 00:11:28,760
so we wanna retrieve the two entries that we've created

250
00:11:28,760 --> 00:11:32,930
in the Database Viewer, so michael = Account("Michael")

251
00:11:38,280 --> 00:11:42,300
and then also terryG, which again we added

252
00:11:42,300 --> 00:11:46,470
in the Database Viewer, = Account("TerryG"), all right.

253
00:11:49,540 --> 00:11:51,120
So if you run this.

254
00:11:53,320 --> 00:11:56,580
You can see we've got, I'll just scroll this up a little bit

255
00:11:56,580 --> 00:11:58,130
just to expand this a little bit higher

256
00:11:58,130 --> 00:12:01,380
so we can see everything, we can see that all six objects

257
00:12:01,380 --> 00:12:04,150
are being populated from the database.

258
00:12:04,150 --> 00:12:05,790
So the first one for John and then we've got one

259
00:12:05,790 --> 00:12:09,000
for Graham, Eric, Michael and TerryG.

260
00:12:09,000 --> 00:12:12,010
And if I just run that again, we can now that I've done that

261
00:12:12,010 --> 00:12:15,740
I've got six retrievals here, we've got John, TerryJ,

262
00:12:15,740 --> 00:12:19,400
Graham, Eric, Michael and TerryG, so all six now

263
00:12:19,400 --> 00:12:21,630
are being populated from the database.

264
00:12:21,630 --> 00:12:24,400
And if you recall with the Michael record,

265
00:12:24,400 --> 00:12:26,430
we didn't specify an account balance,

266
00:12:26,430 --> 00:12:30,300
but you can see here that the balance is showing as five,

267
00:12:30,300 --> 00:12:33,020
so that was retrieved from the accounts table.

268
00:12:33,020 --> 00:12:35,830
All right, so to modify the transactions table,

269
00:12:35,830 --> 00:12:38,220
how do we actually go about making that change?

270
00:12:38,220 --> 00:12:39,560
Well, we open the Database window again,

271
00:12:39,560 --> 00:12:42,000
I can also click over here to open that.

272
00:12:42,000 --> 00:12:45,620
And if we come over here now to the transactions table,

273
00:12:45,620 --> 00:12:49,760
I can right click and choose Modify Table,

274
00:12:49,760 --> 00:12:52,440
and in the Modify Table dialogue, we can just

275
00:12:52,440 --> 00:12:54,200
type the new name for the table,

276
00:12:54,200 --> 00:12:56,280
replace the existing name transactions,

277
00:12:56,280 --> 00:13:00,300
which I mentioned we're gonna do and change that to history.

278
00:13:00,300 --> 00:13:03,070
And notice on the bottom that IntelliJ is helpfully

279
00:13:03,070 --> 00:13:05,890
showing the SQL command that it's gonna execute

280
00:13:05,890 --> 00:13:09,020
to perform the action, so that's honestly pretty cool.

281
00:13:09,020 --> 00:13:10,570
You know, but have in mind though, this doesn't

282
00:13:10,570 --> 00:13:12,650
mean that we can now forget all the SQL movement

283
00:13:12,650 --> 00:13:14,810
so far in the course though.

284
00:13:14,810 --> 00:13:16,760
So I'm gonna Execute the SQL statement,

285
00:13:16,760 --> 00:13:19,590
IntelliJ checks at our code, will check to see our code

286
00:13:19,590 --> 00:13:22,920
to see if anything in there will also need to change,

287
00:13:22,920 --> 00:13:27,150
so I click on Execute, you can see that it's telling us here

288
00:13:27,150 --> 00:13:30,240
that we need to make a change, because it's still referring

289
00:13:30,240 --> 00:13:33,490
to the transactions table, so keep in mind that IntelliJ

290
00:13:33,490 --> 00:13:36,790
doesn't yet take care of changing the code for us

291
00:13:36,790 --> 00:13:39,840
until we actually go ahead and click on Do Refactor.

292
00:13:39,840 --> 00:13:42,690
So click on Do Refactor and you can see over here

293
00:13:42,690 --> 00:13:44,850
obviously history is now the name,

294
00:13:44,850 --> 00:13:46,730
so I'm gonna close that off, database.

295
00:13:46,730 --> 00:13:48,560
But the other thing that we need to change though

296
00:13:48,560 --> 00:13:51,200
is here on line five, noting that it hasn't changed

297
00:13:51,200 --> 00:13:53,640
the transactions table there, so we need to change that

298
00:13:53,640 --> 00:13:58,410
to history and lastly I'm gonna show you is this is also

299
00:13:58,410 --> 00:14:00,890
an option here, when we go to our table

300
00:14:00,890 --> 00:14:03,740
in the Database Viewer, we right click that,

301
00:14:03,740 --> 00:14:06,870
we can click on Rename, but doesn't do the same check

302
00:14:06,870 --> 00:14:10,280
in the source code, so for that reason I think it's better

303
00:14:10,280 --> 00:14:11,830
for you to use the Modify Table

304
00:14:11,830 --> 00:14:14,220
and that's we used that in this video.

305
00:14:14,220 --> 00:14:16,700
All right, and we'll just run this again

306
00:14:16,700 --> 00:14:19,070
to make sure it still works.

307
00:14:19,070 --> 00:14:20,490
And we still got the same results,

308
00:14:20,490 --> 00:14:22,280
we're now using the new table.

309
00:14:22,280 --> 00:14:24,710
All right, so let's now remove the confusion

310
00:14:24,710 --> 00:14:26,500
around the word transaction, so I'm gonna

311
00:14:26,500 --> 00:14:28,900
stop the video here and in the next video,

312
00:14:28,900 --> 00:14:31,020
we're gonna continue on with our accounts programme

313
00:14:31,020 --> 00:14:32,570
and rolling back transactions.

314
00:14:32,570 --> 00:14:34,740
See you in the next video.

