5.3 Tags Model

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
7 hours 36 minutes
Difficulty
Beginner
Video Transcription
00:00
I welcome to Module five Sequel development This is Lesson one, skim a development. We're currently in sub lesson 1.4, implementation of the tags model
00:09
and the previous lesson we went over the requirements and this lesson we're gonna start with implementing the easier models. I believe the easiest malls to implement in this requirement document is going to be the tags and the categories tables. Now it is possible we could combine those into a single table and have a type column that indicates whether or not it's a tag or a category
00:29
that would work.
00:30
But in this example, I'm gonna go ahead and keep tags on its own table and categories on its own table. Just because from experience, I know that these two concepts can function differently. So
00:43
because of that, I'm gonna go ahead and
00:46
keep them on their own tables. With that said, let's go ahead and implement these.
00:51
I'm gonna start by making a new database by right clicking on the databases on my connection. That's letting create new database. We'll go ahead and call this CMS. I'm gonna leave the defaults for the character setting collation.
01:04
I'm gonna go ahead and open that new database. Expand the tables. I'm gonna right click and say Create new table.
01:12
I'm gonna wait for that screen to open up,
01:15
and here we go.
01:17
I'm gonna add a new column. We're gonna We're gonna
01:21
call it the idea column
01:23
because we want a primary key on all our table's. So we're gonna go ahead and implement That
01:26
is gonna be big in unsigned.
01:29
We're not gonna auto increment yet because D viewer doesn't Ah, put those actions in the right order and it causes an air.
01:37
You say that it cannot be No. So it has to have a value, but go ahead and click. Okay.
01:41
Well, go ahead and add another column
01:45
and this column We're gonna call it.
01:47
Ah,
01:49
named
01:49
This is gonna be the tags name bar chart. 100.
01:53
That's plenty big enough. We're gonna go ahead and leave that as a default.
01:56
We're say that can't be. No, you have to have a name.
02:00
We just go ahead and click. Okay?
02:04
And now we need a way that we bind to the article. So let's add the foreign key that we will use. So we're going to create a new column,
02:15
and we're going to call this column
02:17
Art of Coal
02:20
I d
02:22
And that's not allowed to be. No.
02:25
And I know that we're gonna make that type of big end on a signed. So let's go ahead and click. Okay,
02:31
Now, let's go ahead and name this table. We're gonna just name it tag
02:36
or tags,
02:38
and we're gonna save.
02:42
I'm gonna go ahead and persist.
02:44
Now we're gonna finish up the ah increments step of the imager or the i D column.
02:49
So flip on the auto increment and click save.
02:53
Actually, I think we need to make that a key for a stowaway.
02:57
So let's go ahead and make that a key.
03:00
Right click.
03:01
We'll go to the constraints for a click. Create new constraint. Primary key. Select the ideas calm.
03:07
I'll leave the others as the false and
03:12
okay.
03:13
Good. And save that.
03:15
Persist.
03:20
Okay, Go back to the columns
03:22
and were to turn on the auto anchorman again.
03:24
Save,
03:28
Persist.
03:30
Okay, so we have our tax table implemented. We have our tag name, which is of our char,
03:38
which means it could be a string of attacks upto 100 characters long. We're gonna bind later to our article table by a four key constraint. But right now we just added the column
03:46
and, ah, that's all we need for the tax table. So I hope you're able to get the tax table implemented. And I'll see in the next lesson where we implement the category stable.
03:57
Thank you.
Up Next