When designing a new CMS database, what would be the most important features to add? - language-agnostic

While this question asked something similar too, I'm interested in this from another angle. I'm not interested in the GUI part but in the database/domain part.
(My preference is SQL Server with C#/ASP.NET but this Q should be language agnostic.)
When designing a CMS system, data needs to be stored in tables and a business layer needs to provide access to this data. First of all, a user database with user roles, of course. A mailbox for private messages per user would be nice. Allowing users to set up their own profiles with images and eye-candy would make it even more interesting but let's not focus on the users.
What else should there be in the database for a CMS system? And how should it relate to the other tables?
My focus is to get a clear domain model to use as a basis for any CMS system. Something they all share in common. I'm only interested in the design, so I can later evaluate sseveral existing systems with the preferred domain model, to see which one matches the most ideal situation.

You need to decide what features your application needs, and what features beyond that you want to have in your application. From there you can work out what needs to go in your database. You're thinking about this backwards. The database supports the application, not the other way around (unless you're writing phpMyAdmin or similar!).

If it's a CMS for [I assume] dynamically maintaining a website, the first and foremost features should enable the users to:
Add/Edit/Remove pages (aka. nodes) - the structure of the site
Add/Edit/Remove menus, links - the navigation of the site
Add edit media (photos, video, etc.) - the content of the site
Then you can think of the other website-specific management features such as:
Managing products/customers if it's going to manage e-commerce websites
Various kinds of interactivity features -- comment/contact forms, etc.
A CMS is a big project to tackle, specially if you want to make it portable and/or reusable, expandable. I have already come through three versions of my own CMS -- first two versions in PHP and the latest one in .NET.

While design Database for CMS,must be care full about Product/content data tables,registered user data tables and UI related changes data tables.
UI related data is nothing but a themes,skin which is most important.
Most of the CMS application has developed as requirement comes.so most of the times need to break the relation ship in tables and normalization rule.
But if we careful about some basic db structure which is Content pages or content data tables,Product tables,User permission tables(if using aspnet tables then its better),Order management table(for e-commerce sites) etc.
As well as business layer doing most important role when some big changes comes in CMS Project.
Some times tables have a big changes which not effect on pages,need to change in business layer.

What you are asking is a technology question, which is not necessary related to the features the CMS itself has. My advice and the way I would approach it would be to use an ORM. The reason is that when you start designing the database you fall into the niche of DB concepts. The purpose of a CMS is to provide an easy way to manage content.
In this regard, extensibility is far more important than your database design and the user will not be able to see the database design. In short, start with an API, or if that is too much - just start with what you need to expose to the topmost layer. Then just somehow map this to the database without thinking about the structure itself. In this way, you would be concentrating on the problem you are solving rather than on the technology that might be needed to solve it. It feels more natural that way.

Related

How should I store similar entities - in one table or several?

I am creating a CV website, but in difference to most I am trying to make it with database. I mean that usually such websites are static and all of the information is hard coded in the HTML. Since I am back-end developer I like to make it so everything including buttons and welcome messages are taken from the database. I am trying to store projects that I have worked on. There are several types:
Github Repository - a project that is done purely on github.
Work related - a project I have done on work and there is no github repository of it, only link to view the final result
UpWork or other freelance website - as a freelancer I have projects to fix something on a website and those projects can be viewed only on my profile there and I would like to list them with link to UpWork or wherever there is information on what exactly I was hired to do.
Now my question is - should I have different Entities and therefore different tables for these types of projects or should I have all of the possible properties in one table. For example if it is Github there is repository field and if it is work related then there is company field. If it is freelance it has link to the website I was hired on. Also there are different sub-types - web applications, desktop applications, games and so on.
As you can guess the changes are small (1 or 2 properties). I could very easily leave empty some properties and have another property projectType, but is this the right way? Should I have different tables and entities for them?
To give some info - I can work with both MySQL and NoSQL and I havent decided yet on which one should my website be made on. I am currently thinking about NoSQL. This means I am asking on how to store the projects on MySQL and NoSQL (by NoSQL I mean MongoDB). If it helps the languages I am choosing from are PHP (MySQL) and JavaScript (NoSQL)
I know that usually questions without code are downvoted, but this is more of a logic based problem as I know how to do it, but I don't know the best practices for my situation. This being said here is a small code for you -
console.log('Thank you in advance')
MongoDB lends itself very well to this exact situation.
You can create a collection where documents leave out certain fields if they are not needed for that type. The querying parameters of MongoDB allow you to check $exists on fields if you need to, and documents are stored efficiently, only taking up memory where a field is needed.
You can even setup a sparse index which is not required for every document. As long as your core document structure is the same, it is a good idea to keep them in one collection, and vary them based on their type.

Controlling access to data in MySQL, using Node, Express, Knex and Bookshelf

I am very new to database design and structuring - I have had no formal training and am purely self taught so I apologize in advance if this is a bland question.
I am designing a web app and am thinking to the future as users will have to be able to interact with each other sharing part of their data. I am wondering if there is a standard convention to controlling access to tables in MySQL and how I should generally tackle this problem with code written in NodeJS, ExpressJS, KnexJS, and BookshelfJS.
For example: a user will be matched with another user, both users will be able to see location, favourite book, etc but not able to see last name, birth date. etc.
How do I control this?
If anyone could point me to a few resources they have found helpful that would be great as well.
You seem to have learned a bit of MySQL and its access control features. Well, database user level access control IS NOT used by modern applications -- that could make resource management, like connection pools, very hard to implement. Usually SQL databases backing web applications have a single or, at most, two users: one for general data access and one for admin purposes.
The kind of access control you mentioned MUST be handled by your application code, YOUR code. There are libraries that help take care of authentication (e.g. passport) and authorization but ultimately it is YOUR CODE responsibility.
So my answer to your "How do I control this?" question is:
With YOUR code.
This is the whole point of Software Development.

Presentation of a many-to-many relation in web page

Building a library database administration, it has a many-to-many relation (books, writers) and i wonder how to present to the user the management interface.
When editing a book, one must choose writer(s). But how? From a multiple choice drop-down-list? - It would be huge. From a number of drop-down-lists? - hard to control their number and present them in a dedicated module in the page. (Actually the later seems to me a doable solution.)
Any other suggestions? Cheers.
I suggest to use the same way StackOverflow uses to enable you tag multiple technologies while posting a question
It enables you to write the tag manually, and helps you with smart auto complete.
I see this way avoids huge drop down lost and simplifies controlling

Custom digital asset management tool - where to start

I work at a production studio that has hundreds of assets (2D images, videos, 3D models, etc) that we use over and over again in our library. Right now it is just a folder on our server, but because I am a particularly adventurous person I am looking to create a database/application that allows users (approximately 20) to search for and "grab" items from our internal network. I would also need a way for them to upload items to the database - every project we work on we're creating new assets for the library and it grows daily.
I'm a very amateur programmer - mostly working in Javascript and HTML, so what I'm looking for is advice anyone can give me on where to start. From the research I've done I imagine that I would build a MySQL database to store all of the information, and then create an HTML site that all of the users can access via their web browser as the GUI. I know a little bit of Python and really like it so I'm thinking I'll use Python as the back-end and to run MySQL.
I'd love to hear any advice the community can give me! I plan to do this on zero budget, so open-source all the way. The closest tool I can think of to what I want is Adobe Bridge - which I love but which isn't quite what I'm looking for and doesn't have robust enough searching and tagging (and doesn't support anything but images and video).
As a database MySQL isn't particularly suited to this task. The challenge you'll run into is that users will want to access the files in a folder like structure, but for performance reasons you probably will not want a parent-child schema (at least not using InnoDB - I can't speak to the other storage engines). It is certainly possible to create a performant pc schema on InnoDB, but it is not a challenge to be undertaken casually.
If you have access to MSSQL 2012 it makes a tremendous effort at solving this exact problem http://technet.microsoft.com/en-us/library/ff929144.aspx
I love recommending MySQL, but in this case I'd recommend a different database choice.

To add another Database or not to add another Database, that is the questionn

One of my sites is a social networking site running on MySQL. I use postal code and country information to geolocate users using a webservice. This webservice also allows you to download all their many tables of information so that you can access it locally. My site has gotten big enough that I wish to do this now.
My question is, should I create a new database on my site for all of this postal code and country information and all its tables, or should I incorporate those tables into my existing database for my social networking site?
What are the pros/cons either way?
When you're talking about scaling and want to know about other databases like NOSQL, you might find this article interesting: http://highscalability.com/blog/2010/12/6/what-the-heck-are-you-actually-using-nosql-for.html
I'd vote in favor of a separate database if you planned to use the data as read-only and put a web service in front of it to access it. Users would search it based on a small handful of parameters (e.g. address info to get lat/lon data).
I'd say put it in the existing database if you planned to JOIN it with other information in your current schema.
it will live on the same disk probably.
so disk space is not an issue.
if you query the tables in a completely separate manner, then no impact on the existing site.
if you query things together, then easier when all in one database.
overall administration of one database vs 2 is easier.
i think it's a no brainer... they go in one db.