Part 2: Database Schema
What You'll Learn
Prerequisites
Database Design
USERS CATEGORIES
├── id (PK) ├── id (PK)
├── username (unique) ├── name
├── email (unique) ├── slug (unique)
├── first_name ├── created_at
├── last_name └── updated_at
├── active
├── created_at
└── updated_at
POSTS COMMENTS
├── id (PK) ├── id (PK)
├── title ├── content
├── content ├── post_id (FK)
├── published ├── user_id (FK, nullable)
├── views_count ├── created_at
├── user_id (FK) └── updated_at
├── category_id (FK)
├── created_at
└── updated_atStep 1: Create Users Migration
Step 2: Create Categories Migration
Step 3: Create Posts Migration
Step 4: Create Comments Migration
Step 5: Run the Migrations
Step 6: Verify the Schema
Understanding the Schema
Migration Best Practices
Common Column Types
CQL Type
SQLite
PostgreSQL
MySQL
Summary
Next Steps
Last updated
Was this helpful?