All right, Welcome back to Model five Sequel development. This is less than one skimmer development, and we're currently in sub lesson 1.6 implementation of the article model.
Now, with respect to the article model, there's a couple things we need to consider. First of all, there seems to be multiple types that we can have tutorials reviews, news articles. Now do we need multiple tables? Do we need a tutorial table reviews table and a news article stable?
I don't think we do. I think we can implement a type column so we'll create a articles table that has a type column that indicates what type the article is. I think I will work just fine and allow us to have one table and reduce some complexity of our database by having fewer tables.
And what else did we have? We had
can only be edited or deleted by the owner or admin, So to facilitate
who the owner is, we're gonna add a author I D column that indicates the author,
and we also see that it can have multiple images.
Multiple images is actually going to be its own table, so we're not gonna worry about that right now
because the Emperor will be in images table
that has that stores the images for the articles.
Now, with that said, let's start making the articles table. But we left Click on tables,
right click and select. Create new table.
Well, go ahead and name is articles.
Go ahead and create a new column.
Call it the I d. Calm.
We're gonna make that a big and unsigned
and it's not allowed to be. No, it has to be filled in
Now most articles have a title, so we're gonna go ahead and add a title column. March are 100 should cover. The title's gonna say that it cannot be No. So it has to have a value.
We're gonna add another column. I'll call it in the body,
and we're going to change this from March are 100 which is most certainly not enough for an article body.
I'm gonna change that to text, which means it could be a large amount of texts which should cover
on article of the almost any size, so we'll go ahead and click. Okay,
let's go ahead and add in our constraint for the primary key,
We're gonna head back to columns.
Now. We need to add the author i d column
so that we know who wrote the article.
And we know that's gonna be a big an unsigned, because that's what we are making all our keys.
You say that cannot be? No. Somebody offered the article. It needs to be filled in.
And now we need to add our type column. So we're gonna say type
and Bart Starr 100 should be fine for the different types. Uh, shouldn't really exceed that character life
Gonna go ahead and click
We're gonna go ahead and turn on the auto increments.
So the idea feel takes care of itself.
And that completes our article stable.
I hope you were able to get the article stable implemented, and I'll see you in the next lesson. Thank you.