Database Overview
MyEasyGuide uses two independent PostgreSQL databases, each owned by a separate application. They can share the same Postgres instance, but there are no cross-database foreign keys or database-level joins.
| Database | Application | Schema file |
|---|---|---|
myeasyguide_prod | api.myeasyguide.com | prisma/schema.prisma |
cms_myeasyguide | cms.myeasyguide.com | prisma/schema.prisma |
At a glance
| Aspect | API database | CMS database |
|---|---|---|
| Models | 37 | 10 |
| Enums | 12 | 0 (statuses are strings) |
| Domain | Commerce: activities, catalog, bookings, payments, suppliers, payouts, inquiries, users | Content: posts, taxonomy, authors, places, media, redirects |
| ID strategy | nanoid(21) generated by Postgres | cuid() generated by Prisma |
| Prisma | 7.10 | 7.8 |
| Migrations | 39 | Managed separately in the CMS repo |
Why two databases?
The CMS was originally part of the Express API. As the project grew, content management was extracted into a standalone Next.js application with its own database. This provides:
- Independent scaling — Content reads do not compete with booking and payment traffic.
- Independent deployments — The CMS can ship without restarting the API.
- Schema isolation — Editorial models change without risking commerce data.
- Security isolation — CMS credentials cannot read orders or personal data.
Relationship summary
API database (myeasyguide_prod)
Admin (standalone staff accounts)
User ──books──> Booking ──has──> Payment
User ──writes──> Review <──belongs to── Activity
User ──saves──> Wishlist ──> Activity
Supplier ──owns──> Activity ──has──> Departure / Availability
Supplier ──receives──> Inquiry <──about── Activity
Supplier ──requests──> Payout
Activity ──belongs to──> Category
Activity ──primary location──> Location ──type──> LocationType
Activity <──M:N──> Location / Keyword / FoodType / FoodFormat /
DietaryRestriction / TransportType /
SuitabilityConcern / ActivityRestriction / MandatoryItem / FeaturedTag
NewsletterSubscriber (standalone)
Media, LegalPage ──> LegalPageCategory (standalone)CMS database (cms_myeasyguide)
Post ──> PostCategory / SubCategory
Post ──> Author
Post ──> City / Country
Post ──> Tag (tags are stored as a comma-separated string on Post)
GenerationBatch (tracks Claude batches that create posts)
Media, Redirect (standalone)Naming differences
| Concept | API | CMS |
|---|---|---|
| Place | Location + LocationType (tree) | City + Country (flat) |
| Category | Category | PostCategory + SubCategory |
| Article | — | Post |
| Author | — | Author (CMS login) |
| Media | Media (category, relatedId) | Media (alt, caption, dimensions, no relation) |
The two City concepts are unrelated tables. A CMS city does not reference an API location, and vice versa.
Legacy editorial tables
The API database may still contain tables from before the editorial migration: blog, blog_category, author, the generation import/job tables, and business_link. They are no longer in the API Prisma schema.
Do not run prisma migrate from the API expecting those tables to be preserved. Prisma will propose dropping anything it no longer knows about. Take a backup first if the historical content matters.