-
Notifications
You must be signed in to change notification settings - Fork 0
DATABASE.md
Jason Brain edited this page Jan 10, 2026
·
1 revision
This document outlines the schema design for Core CMS.
Note: For the raw SQL queries used to create these tables, refer to
../db/schema.sql.
Stores administrators and editors.
-
Primary Key:
id -
Security: Passwords must be hashed using
password_hash()(Bcrypt/Argon2). - Roles: Currently supports 'admin' (full access). Future: 'editor', 'author'.
The central content table. We use a Polymorphic approach here to keep the DB light.
-
Primary Key:
id -
Foreign Key:
author_id->users.id -
Key Column:
post_type-
'post': Standard blog entries. -
'page': Static content (About, Contact).
-
-
Status:
'published','draft','archived'.
Key-value storage for site-wide settings (Site Title, Timezone, etc.).
-
Structure:
option_name(Unique String) |option_value(Text).
Containers for navigation lists (e.g., "Main Header", "Footer Links").
-
Columns:
id,name,slug.
The actual links inside a menu.
-
Foreign Key:
menu_id->menus.id -
Hierarchy:
parent_idallows for dropdowns/nested links. -
Ordering:
sort_order(Integer) determines display position.
Stores event-specific data. This is separate from posts to allow for specific columns like dates and capacity without bloating the main content table.
-
Columns:
start_date,end_date,location,capacity. -
Future: Could link to
usersfor an attendee list table (event_attendees).
Organizes content.
-
Categories: Hierarchical (
parent_id). - Tags: Flat keywords.
-
Pivot Tables:
post_categoriesandpost_tagslink these toposts(Many-to-Many).
Stores metadata for uploaded files.
-
Columns:
file_name,file_path(relative to root),file_type(MIME). -
Storage: Physical files reside in
/uploads/{year}/{month}/.