data-model-design

Design MikroORM and PostgreSQL entities, relationships, and migration lifecycles.

1.6k|354|Updated Sep 10, 2025
One-click install
npx skills add https://github.com/open-mercato/open-mercato --skill data-model-design-open-mercato
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: data-model-design
Source: https://github.com/open-mercato/open-mercato/tree/main/packages/create-app/agentic/shared/ai/skills/data-model-design
Command: npx skills add https://github.com/open-mercato/open-mercato --skill data-model-design-open-mercato

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of designing database schemas, defining entities and their relationships, and managing the lifecycle of database migrations, ensuring data integrity and maintainability.

Core Features & Use Cases

  • Entity Design: Create new entities with standard columns and flexible field types.
  • Relationship Management: Define one-to-one, one-to-many, and many-to-many relationships, including cross-module references.
  • Migration Lifecycle: Generate, review, and apply database migrations safely.
  • Use Case: When building a new feature that requires storing user profiles and their associated preferences, use this Skill to define the UserProfile and UserPreferences entities, establish a one-to-one relationship, and generate the necessary database migration scripts.

Quick Start

Use the data-model-design skill to create a new entity called 'Product' with 'name' and 'description' fields.

Frequently Asked Questions about data-model-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design entity relationships and manage database migrations with MikroORM and PostgreSQL?

To design entity relationships and manage database migrations, you define entities with appropriate field types and relationship patterns, then generate, review, and apply migration scripts. This ensures data integrity and maintainability across your application schema.

What is the best way to model cross-module references in a PostgreSQL schema?

The best way to model cross-module references in a PostgreSQL schema is by implementing cross-module references via foreign key IDs. This approach maintains strict boundaries between modules while preserving relational data integrity.

How do I generate and apply database migrations safely for new schema changes?

To generate and apply database migrations safely, you create or update your entity definitions, generate the migration scripts, review the proposed schema changes, and apply them following best practices for column management and soft deletion.

Can I define polymorphic and self-referencing relationships using MikroORM entities?

Yes, you can define polymorphic and self-referencing relationships using MikroORM entities. The data modeling process supports implementing these standard relationship patterns alongside one-to-many and many-to-many configurations.

What PostgreSQL field types should I select when designing a new database entity?

When designing a new database entity, you should select appropriate field types such as varchar, text, int, decimal, boolean, uuid, timestamptz, and jsonb. Choosing the correct type ensures optimal data storage and query performance.