Skip to content

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.

DatabaseApplicationSchema file
myeasyguide_prodapi.myeasyguide.comprisma/schema.prisma
cms_myeasyguidecms.myeasyguide.comprisma/schema.prisma

At a glance ​

AspectAPI databaseCMS database
Models3710
Enums120 (statuses are strings)
DomainCommerce: activities, catalog, bookings, payments, suppliers, payouts, inquiries, usersContent: posts, taxonomy, authors, places, media, redirects
ID strategynanoid(21) generated by Postgrescuid() generated by Prisma
Prisma7.107.8
Migrations39Managed 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 ​

ConceptAPICMS
PlaceLocation + LocationType (tree)City + Country (flat)
CategoryCategoryPostCategory + SubCategory
Article—Post
Author—Author (CMS login)
MediaMedia (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.

Built with VitePress