Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,440 --> 00:00:08,430
Pokey's Fatmata course of Lavallade, EPA, Dalip and Will, this is part five inside this feed you
2
00:00:08,690 --> 00:00:13,610
will see the concept of migration and its very basic commands.
3
00:00:14,480 --> 00:00:21,980
So if a part of project set up in the last video we had seen our first program inside Laravel.
4
00:00:22,490 --> 00:00:28,660
Inside that video we had created a controller, a simple robot and a few file.
5
00:00:29,630 --> 00:00:33,950
Also, we had seen a concept, something called BHP Optician.
6
00:00:34,670 --> 00:00:42,890
So BHP Partition Inside Lamell is a command line to Orsi command line interface, which interacts with
7
00:00:43,090 --> 00:00:44,570
lateral application.
8
00:00:45,410 --> 00:00:54,140
So if I back to terminal, if I type the command called VSP Optician, now as we can see that we are
9
00:00:54,140 --> 00:01:03,680
getting a command bolade each command of this command palette is for us for some specific task.
10
00:01:04,670 --> 00:01:12,200
In the last video, as we had seen that by the help of this controller, we have completed the task
11
00:01:12,200 --> 00:01:14,450
of creating a new controller class.
12
00:01:15,230 --> 00:01:22,430
So each command of this partition is created to complete any single specific task.
13
00:01:23,760 --> 00:01:30,180
Now, from this command palette and this time we will see the concept of migration, so we will use
14
00:01:30,180 --> 00:01:35,190
a command from this command palette, something called make migration.
15
00:01:35,730 --> 00:01:37,110
And here's the command.
16
00:01:37,830 --> 00:01:41,430
The description is something, create a new migration file.
17
00:01:42,330 --> 00:01:49,260
So before starting this migration, first of all, we need to understand that what is a migration file?
18
00:01:50,520 --> 00:01:56,000
So migration file is a file which is going to provide a devilly structure.
19
00:01:56,400 --> 00:02:01,620
It means inside this file will define a structure, something let's say for the users.
20
00:02:01,620 --> 00:02:06,440
They will if we want some columns like Naem email, phone number.
21
00:02:06,660 --> 00:02:15,030
So we will specify the name of columns as well as the data type, optionally we can pass the size as
22
00:02:15,030 --> 00:02:15,460
well.
23
00:02:16,080 --> 00:02:18,930
So these are the things means they structure related.
24
00:02:19,170 --> 00:02:23,030
These are the things we will define inside migration files.
25
00:02:23,970 --> 00:02:27,260
So let's get this started all about creating a migration file.
26
00:02:27,720 --> 00:02:35,400
So firstly, when we create any migration file, it will go and is to inside this database and migration
27
00:02:35,500 --> 00:02:37,680
filter by default.
28
00:02:37,980 --> 00:02:44,070
When we install a label, set up these three migration files for will get inside this setup.
29
00:02:45,390 --> 00:02:52,350
So when we open any of the migration file, as we can see that it's a glass and inside this glass we
30
00:02:52,350 --> 00:03:01,470
have two methods call up motherhood and down motherhood upma that is going to provide the schema or
31
00:03:01,470 --> 00:03:09,180
we can see the architecture of the will and the down method is going to simply drop that table from
32
00:03:09,180 --> 00:03:10,170
the database.
33
00:03:11,100 --> 00:03:18,790
When we migrate our migration into the database, the migrate come on behind the scene, use this up
34
00:03:18,810 --> 00:03:19,560
method.
35
00:03:20,010 --> 00:03:26,670
But when we run rule, demand means dropping a table so behind the scene don't matter.
36
00:03:26,670 --> 00:03:34,770
Vilborg so let's create a migration file inside that migration file will definitively Sokcho add few
37
00:03:34,770 --> 00:03:38,030
columns and migrate into databases.
38
00:03:39,720 --> 00:03:47,550
So if I open Litsa Ed something called goateed inside this, what I will do will create a student's
39
00:03:47,550 --> 00:03:49,710
table and say this is too unstable.
40
00:03:49,710 --> 00:03:57,980
We will have the column called Name Email Litsa Each and something let's say for an underscore number.
41
00:03:58,440 --> 00:04:02,130
So these are the columns and one more thing listed Jinto.
42
00:04:02,550 --> 00:04:07,170
So these are the columns being to define inside students migration.
43
00:04:08,460 --> 00:04:13,080
So back to terminal, first of all, will define a migration file.
44
00:04:13,380 --> 00:04:27,600
So BHB addition lets meek migration and we create, let's say, Keat on the school students on the school
45
00:04:27,600 --> 00:04:35,540
teeple or simply we will call it as something like this cricket student's table.
46
00:04:36,330 --> 00:04:43,020
Now if I press enter, as we can see that migration heated back to full disclosure.
47
00:04:43,020 --> 00:04:48,710
Go and reload and here we can get the migration file for our students typically.
48
00:04:49,320 --> 00:04:56,010
So by default it provides the EITE column and two timestamp values like created ADD and updated.
49
00:04:56,010 --> 00:05:05,790
And so what we want we want a few columns, let's say for the Naem so deeply and for the name we need
50
00:05:05,790 --> 00:05:08,520
to store the name value into a Vacher field.
51
00:05:08,790 --> 00:05:11,100
So it will be of a string type.
52
00:05:11,820 --> 00:05:13,860
So we need two columns as assignee.
53
00:05:14,850 --> 00:05:16,170
So inside this is string.
54
00:05:16,680 --> 00:05:18,030
Let's pass the name column.
55
00:05:18,040 --> 00:05:23,240
This is the column name and optionally we can pass the length of the field.
56
00:05:23,640 --> 00:05:25,620
So this is 120 characters.
57
00:05:26,550 --> 00:05:28,450
Next we need for the email address.
58
00:05:28,460 --> 00:05:38,340
So if I copy pasting it to email field, let's say it is of eighty characters in length in the next
59
00:05:38,550 --> 00:05:39,740
we each.
60
00:05:40,410 --> 00:05:43,800
So Table eight should be the Intisar value.
61
00:05:43,810 --> 00:05:46,470
So Intisar each.
62
00:05:46,920 --> 00:05:49,470
And this is unsigned.
63
00:05:50,970 --> 00:05:53,430
Now next we want phone number.
64
00:05:53,790 --> 00:06:00,300
So number was also the string value, but in this case it is of twenty characters inland.
65
00:06:00,840 --> 00:06:04,190
And finally we want Ajanta column.
66
00:06:04,800 --> 00:06:09,390
So here instead of a string let's pass enum.
67
00:06:11,460 --> 00:06:17,730
And here inside this email, as you can see that the intelligence is that the first read to pass the
68
00:06:17,730 --> 00:06:21,380
column name solicited Chinta is the column name.
69
00:06:21,840 --> 00:06:22,780
Next we have then.
70
00:06:23,560 --> 00:06:32,360
Inside is a read to pass all available options, so Gentil, if you want something, me female.
71
00:06:33,760 --> 00:06:42,130
Now, if you save all these changes now next, if you want to migrate this migration file into our database,
72
00:06:42,340 --> 00:06:46,210
what we had created inside last for to this is the database.
73
00:06:46,210 --> 00:06:55,090
We have configured that terminal PSP optician and type migrate.
74
00:06:55,720 --> 00:07:01,590
This command is going to run all the pending migrations and migrate into our database.
75
00:07:02,470 --> 00:07:10,770
So if I press enter, as you can see, that aggregate users migrated and here we have some added that
76
00:07:10,900 --> 00:07:16,320
is already accessed, duplicate column name called email.
77
00:07:17,080 --> 00:07:22,800
So I think that inside our students migration, we had actually written two times email address.
78
00:07:23,500 --> 00:07:26,600
So here is the email first and email actually.
79
00:07:26,600 --> 00:07:34,750
This is for Number Swaggy, and if I clear this console, then one more time addition migrate.
80
00:07:35,080 --> 00:07:43,450
And before that, what I will do, simply take all the tables from DBI, go inside who are a drop.
81
00:07:43,930 --> 00:07:52,780
I will drop all the tables inaudible sexist cards on this command so users a will created password resets
82
00:07:52,960 --> 00:07:56,080
field jobs and finally the table.
83
00:07:56,080 --> 00:07:58,150
What we had created call is to dance.
84
00:07:59,740 --> 00:08:08,040
Back to Brazil is a structure, and he, as we can see, that we have a student stable go inside this
85
00:08:08,050 --> 00:08:08,780
structure.
86
00:08:09,310 --> 00:08:13,910
Here are the columns called NI E Mail, each phone number.
87
00:08:14,140 --> 00:08:24,790
And to look at the data, I call Vacher, 120 characters in length, E.T. phone number enumerator with
88
00:08:24,790 --> 00:08:34,980
all possible values and by default, three columns added called EDEK created out and updated at night.
89
00:08:34,990 --> 00:08:42,780
If we want to drop all the tables, what we Catron simply go and type the command called BHB addition
90
00:08:43,630 --> 00:08:50,410
my great galloon and passa flat call rule back behind the scene.
91
00:08:50,860 --> 00:08:58,420
When we had on this command a task actually executed the method of every migration file.
92
00:08:59,170 --> 00:09:03,430
But when we execute this command, partition migrates rule back.
93
00:09:03,850 --> 00:09:10,350
It will go and find the last migrated files and run that down method.
94
00:09:11,650 --> 00:09:16,770
So when we done this, come on, it will search for the latest migration of what we had done.
95
00:09:16,960 --> 00:09:20,200
So these all migrations, what we have migrated.
96
00:09:20,410 --> 00:09:27,520
So it will go inside each of the migration file and run the town method and inside down method.
97
00:09:27,790 --> 00:09:30,450
We have to go on to draw up the table.
98
00:09:31,120 --> 00:09:39,380
So if we go and pressing enter, as we can see that it has rolled back, all the tables go and Lutetia,
99
00:09:39,390 --> 00:09:48,310
this structure and as we can see that we don't have any table knocking if we want to migrate all the
100
00:09:48,310 --> 00:09:53,590
tables again in the same come on called BHP addition migrate.
101
00:09:54,760 --> 00:09:57,160
Is there any command to migrate?
102
00:09:57,310 --> 00:10:01,270
All this is the only come on to roll back first and migrate.
103
00:10:01,510 --> 00:10:04,630
Yes, we have we have the same.
104
00:10:04,630 --> 00:10:05,080
Come on.
105
00:10:05,080 --> 00:10:08,410
Let's say that if we run this migrate, come on.
106
00:10:08,890 --> 00:10:12,550
It has migrated all the tables inside DBRS.
107
00:10:14,200 --> 00:10:19,510
If we go and see here, we have all the tables in some cases.
108
00:10:19,750 --> 00:10:26,770
First we want to drop all the tables and in the next we want to create all the tables.
109
00:10:27,550 --> 00:10:32,560
We want to execute two different commands, but inside a single line.
110
00:10:33,820 --> 00:10:41,380
So simply type B, partition, migrate and Hillsville type called refresh.
111
00:10:42,070 --> 00:10:49,840
If I press enter as we can see that first it has rolled back all the tables and in the second stage
112
00:10:50,140 --> 00:10:52,780
it has migrated all the tables.
113
00:10:54,220 --> 00:11:00,220
So this is all about guys migration, which has provided the table schema for the database.
114
00:11:00,520 --> 00:11:05,920
And as we know that the tables are the storage area will put all data.
115
00:11:07,090 --> 00:11:10,540
So in the next video, we will discuss the concept of Cedar's.
116
00:11:10,900 --> 00:11:19,810
By the help of Setas, we put our dummy data or Feek data for the purpose of testing so far this session.
117
00:11:19,810 --> 00:11:22,100
Guys, thanks for watching and have a great.
12341
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.