Database Overview
MyEasyGuide uses two independent PostgreSQL databases, each owned by a separate application. They share the same Postgres instance but have no cross-database foreign keys or direct communication.
| Database | Application | Schema File |
|---|---|---|
walkthroughnepal | api.myeasyguide.com | prisma/schema.prisma |
cms_myeasyguide | cms-myeasyguide | prisma/schema.prisma |
Key Differences
| Aspect | API Database | CMS Database |
|---|---|---|
| Models | 18 models + 9 enums | 8 models |
| Domain | Commerce (activities, bookings, payments, suppliers, users) | Content (posts, authors, categories, tags) |
| Shared models | City exists here | City also exists here (separate table) |
| Migrations | 17 migration files | Multiple migration files |
| Prisma version | 7.1 | 7.8 |
Why Two Databases?
The CMS was originally part of the Express API. As the project evolved, content management was extracted into a standalone Next.js application with its own database. This provides:
- Independent scaling — Content operations don't compete with commerce queries
- Independent deployments — CMS can be updated without touching the API
- Schema separation — CMS models (Post, Tag, GenerationBatch) are optimized for content workflows
- Security isolation — CMS database credentials are separate from the API
Model Relationship Summary
API Database (walkthroughnepal)
Admin ──authors──> Activity <── references ── City
User ──books──> Booking ──pays──> Payment
Supplier ──owns──> Activity <── reviews ── Review
Activity <── categorizes ── TripCategory
Activity <── types ── TripType
Activity <── located_in ── City / Region
Activity <── features ── FeaturedTag (M:N via ActivityFeaturedTag)
User <── saves ── Wishlist
User <── subscribes ── NewsletterSubscriberCMS Database (cms_myeasyguide)
Post ──belongs_to──> PostCategory / SubCategory
Post ──written_by──> Author
Post ──located_in──> City / Country
Post <── tagged_with ── Tag
GenerationBatch ──generates──> PostEditorial Migration Impact
As part of the editorial migration, the following models were removed from the API schema (tables remain in the database but are no longer managed by the API's Prisma):
| Removed Model | Replaced By (CMS) |
|---|---|
Blog | Post |
BlogCategory | PostCategory |
Author | Author (new table in CMS DB) |
BlogGenerationImport | GenerationBatch |
BlogGenerationImportRow | — (simplified in CMS) |
BlogGenerationJob | — (simplified in CMS) |
BusinessLink | — (feature removed) |
Important: The database tables for these models still exist in walkthroughnepal. Running prisma migrate from the API would drop them. Do not run migrations until you are certain no data is needed from these tables. See the Editorial Migration page for details.