Introduction to Database Design - Step 2
If you plan to have comments on the news articles, then they will need a separate indexing of who the author is, what is his contact, whether he is a member or not and so on and so forth. Whether you want only existing authors to be able to make comment or you want to keep it open. As you gradually answer these questions, the way the CMS will work will become clearer to you.
it is imperative that the database should be made with an idea that the additional features might be added later, the maximum of the data should be put in the beginning and there should be openings for the feature requests that you might get later on. If the database is made minimal with an intention to add features later, the process will be difficult as then the whole database will have to be redesigned and will be extremely useless and time consuming, thus it is greatly recommended that the maximum if the work should be done at the time of compiling the database.
The design and the user friendliness of the database is also a very important feature that you have to keep in mind at all times. It can affect the speed of the database, so if it is poorly designed and the queries are complicated, then the speed will be greatly affected.
The ultimate thing to keep in mind is that there should not be a rush, it is a complicated piece of work and you need to think as much as you can and then figure out everything you need in the beginning itself and make sure you are not missing anything.
The table structure for the news can be something like this
- title
- content
- author
- approved
- category
The first question is how to identify a row in a unique manner? This is important for you to be able to identify each row so that the database can be edited easily, unless that is done the chances of you deleting the wrong entry are quite high.
We can use an ‘auto_increment’ field, in postgresql it’s a ’serial’ field. This will make sure that each row is identified separately and it will update automatically each time a row is added. We can make this the primary key.
Filed under: Databases