1
00:00:00,930 --> 00:00:06,480
So before we deploy our application to our server, we need to make one slight change to our migration's.

2
00:00:06,900 --> 00:00:10,530
If you recall, at no point did we seed our users table.

3
00:00:10,530 --> 00:00:15,360
So if we were to deploy our application to our live server and run the migration's, we would have a

4
00:00:15,360 --> 00:00:18,290
functional application, but no means of logging in.

5
00:00:18,420 --> 00:00:20,840
And fortunately, it's really easy to add that migration.

6
00:00:21,120 --> 00:00:23,960
So I'm going to open a terminal window, make sure I'm in the right direction.

7
00:00:24,090 --> 00:00:26,400
I am, and I will generate a migration.

8
00:00:26,400 --> 00:00:36,150
So to generate and I'll generate this one a sequel, add user to user table or whatever you want to

9
00:00:36,150 --> 00:00:36,480
call it.

10
00:00:37,260 --> 00:00:37,950
And that generates.

11
00:00:38,550 --> 00:00:44,220
So what I'm going to do just to save some time is I'm going to go over to postcode and find my users

12
00:00:44,220 --> 00:00:46,860
table and look for content in there.

13
00:00:47,250 --> 00:00:51,510
And I will select this and I will copy it as an insert statement.

14
00:00:52,320 --> 00:00:59,280
And then I'll go back to my migration, open up the up migration, which is this one, and just paste

15
00:00:59,280 --> 00:01:01,110
that sequel in there because it's sequel.

16
00:01:01,120 --> 00:01:02,020
This should work fine.

17
00:01:02,610 --> 00:01:08,250
Now, one thing I'm going to do is I'll get rid of this column that says ID and I'll let Auto Increment

18
00:01:08,250 --> 00:01:09,450
take care of that for me.

19
00:01:17,000 --> 00:01:24,060
And I should work, so let's run this migration sota migrate now before I run it.

20
00:01:24,080 --> 00:01:28,340
Obviously, I have to delete the existing user in the database, so let me do that first.

21
00:01:28,950 --> 00:01:32,410
I'll just delete this row, save the changes.

22
00:01:32,420 --> 00:01:33,910
So now this table is empty.

23
00:01:34,070 --> 00:01:36,740
So when I run this migration, it should insert that for me.

24
00:01:38,690 --> 00:01:44,030
So when I reload this, it should be in there perfect, so now we have this migration and I'll leave

25
00:01:44,030 --> 00:01:49,220
the down migration empty because really I don't really ever want to down migrate that part.

26
00:01:50,300 --> 00:01:55,580
And when I get to the down migration that drops the user table, that'll delete that record anyway.

27
00:01:55,640 --> 00:02:00,590
So if you want to, you could you could just in your down migration, if you really want to be perfect,

28
00:02:00,590 --> 00:02:06,560
you could just say delete from users where and look at something here.

29
00:02:07,100 --> 00:02:16,220
Email equals and whatever the value is edman at admin dot com and that would be a down migration.

30
00:02:16,310 --> 00:02:17,330
It's entirely up to you.

31
00:02:17,630 --> 00:02:18,050
All right.

32
00:02:18,050 --> 00:02:20,000
So that should take care of the seeds for us.
