Templates / Blog / CMS
Blog Database Schema (ERD Template)
A blog / CMS database schema covering the standard publishing workflow: authors write posts, posts belong to an optional category and any number of tags through a join table, and readers leave comments. Deleting a post cascades to its tags and comments, while authors are protected from accidental deletion while they still own posts.
Tables
| Table | Purpose |
|---|---|
users | Authors and commenters |
categories | One category per post (optional) |
posts | Content with slug, status, publish date |
tags | Free-form labels |
post_tags | Post ↔ tag join, unique pair |
comments | Reader comments per post |
Schema highlights
- ON DELETE SET NULL on posts.category_id — removing a category keeps the posts
- ON DELETE RESTRICT on posts.author_id — an author with posts can't vanish
- post_tags models many-to-many with a UNIQUE (post_id, tag_id) guard
- Ships with a starter glossary and an Email domain — naming compliance starts at 100%
How to use it
- Click Open in Sqemo — the template loads as a new local project (nothing is uploaded, no account needed).
- Rename entities and attributes; physical names follow your glossary and naming rules automatically.
-
Export
CREATE TABLESQL for MySQL, PostgreSQL, SQL Server, Oracle, SQLite, H2, or CUBRID — or DBML.
Prefer your own baseline? Import SQL or DBML and Sqemo builds the diagram, foreign keys included.