Le Rocher Académie uses PostgreSQL 15 with Doctrine ORM.
Primary user entity for authentication and authorization.
Fields:
id: Primary key (auto-increment)email: Unique email addresspassword: Hashed passwordroles: JSON array of rolesfirstname,lastname,fullnameusername: Unique username (slug)image: Profile picture pathbio: User biographybirth_date: Date of birthscore: Gamification scorepayment_status: Payment status enumis_verified: Email verification flagcreated_at,updated_at: Timestamps
Relationships:
- Many courses (authored)
- Many completions
- Many cohorts (enrolled)
- Many notifications
- Many notes
Learning courses with structured content.
Fields:
id: Primary keytitle: Course titleslug: URL-friendly slugdescription: Course descriptionimage: Course thumbnailstatus: Published statuscreated_at,updated_at
Relationships:
- Belongs to User (author)
- Has many Modules
- Has many Completions
- Belongs to many Cohorts
Course sections organizing lessons.
Fields:
id: Primary keytitle: Module titledescription: Module overviewposition: Sort ordercreated_at,updated_at
Relationships:
- Has many Lessons
- Belongs to many Courses
- Has many Completions
Individual learning units.
Fields:
id: Primary keytitle: Lesson titlecontent: Lesson content (rich text)video_url: Optional videoduration: Estimated durationposition: Sort ordercreated_at,updated_at
Relationships:
- Belongs to Module
- Has many Completions
- Has many Comments
- Has many Notes
Tracks user progress.
Fields:
id: Primary keycompleted_at: Completion timestampprogress: Progress percentage (0-100)
Relationships:
- Belongs to User
- Polymorphic: Course, Module, or Lesson
Scheduled course groups.
Fields:
id: Primary keytitle: Cohort nameslug: URL slugstart_at: Start datecapacity: Maximum studentsstatus: Published statuscreated_at,updated_at
Relationships:
- Has many Users (students)
- Has many Courses
User notifications.
Fields:
id: Primary keytitle: Notification titlemessage: Notification contenttype: Notification typeread_at: Read timestampsend_at/sent_at: Schedulingcreated_at,updated_at
Relationships:
- Belongs to User
Achievements and awards.
Fields:
id: Primary keyname: Badge nameslug: URL slugdescription: Badge descriptionimage: Badge iconrarity: Badge rarity levelcreated_at,updated_at
Relationships:
- Belongs to BadgeType
- Awarded to many Users
- Comment: Lesson comments
- Note: Personal user notes
- Page: Static CMS pages
- PaymentSetting: Payment configuration
- ResetPasswordRequest: Password reset tokens
- Calendar: Calendar events
# Generate migration from entity changes
docker compose exec php bin/console make:migration
# Review generated migration
cat migrations/VersionYYYYMMDDHHIISS.php
# Execute migration
docker compose exec php bin/console doctrine:migrations:migrate- Review Before Execution: Always review generated migrations
- Test Locally First: Run migrations on dev before production
- Backup Production: Always backup before migrating production
- Rollback Plan: Ensure
down()methods work
Key indexes for performance:
user.email(unique)user.username(unique)course.slug(unique)course.author_id(foreign key)completion.user_id, completable_type, completable_id(composite)
# Backup database
docker compose exec database pg_dump -U app app > backup.sql
# Restore database
docker compose exec database psql -U app app < backup.sql# Optimize database
docker compose exec database psql -U app -d app -c "VACUUM ANALYZE"User ──< Completion >── Course/Module/Lesson
User ──< Note >── Lesson
User ──< Comment >── Lesson
User ──< Notification
User ──< Badge
User ──< Cohort >── Course
Course ──< Module ──< Lesson
- Review Architecture
- Learn about Development
- See Migration Guide