mikro-orm-markdown
MikroORM 엔티티에서 바로 만드는 Mermaid ERD와 Markdown 스키마 문서. DB 연결이 필요 없습니다.
npm install -D mikro-orm-markdown/** * Blog post authored by a registered user. * @namespace Blog */@Entity()export class Post { @PrimaryKey({ type: 'integer' }) id!: number;
/** Post title */ @Property({ type: 'string' }) title!: string;
@Property({ type: 'text', nullable: true }) body?: string;
@ManyToOne({ entity: () => Author }) author!: Author;}/** * Registered user who writes posts. * @namespace Blog */@Entity()export class Author { @PrimaryKey({ type: 'integer' }) id!: number;
@Property({ type: 'string' }) name!: string;
@Property({ type: 'string', unique: true }) email!: string;}/** * Blog post authored by a registered user. * @namespace Blog */export const PostSchema = new EntitySchema({ name: 'Post', properties: { id: { type: 'integer', primary: true }, /** Post title */ title: { type: 'string' }, body: { type: 'text', nullable: true }, author: { kind: 'm:1', entity: 'Author' }, },});/** * Registered user who writes posts. * @namespace Blog */export const AuthorSchema = new EntitySchema({ name: 'Author', properties: { id: { type: 'integer', primary: true }, name: { type: 'string' }, email: { type: 'string', unique: true }, },});/** * Blog post authored by a registered user. * @namespace Blog */export const PostSchema = defineEntity({ name: 'Post', properties: (p) => ({ id: p.integer().primary(), /** Post title */ title: p.string(), body: p.text().nullable(), author: () => p.manyToOne(AuthorSchema), }),});/** * Registered user who writes posts. * @namespace Blog */export const AuthorSchema = defineEntity({ name: 'Author', properties: (p) => ({ id: p.integer().primary(), name: p.string(), email: p.string().unique(), }),});ERD.md
npx mikro-orm-markdown --config ./mikro-orm.config.ts --out ./ERD.md무엇을 만들어 주나요
섹션 제목: “무엇을 만들어 주나요”- ERD + 컬럼 표
Mermaid ER 다이어그램과 함께, 실제 DB 컬럼명, 키, nullable 여부, 설명, 인덱스, 제약 조건을 담은 엔티티별 표를 만듭니다.
- JSDoc 기반
설명, 섹션(
@namespace,@erd,@describe), 노출 여부(@hidden)를 엔티티 파일에 이미 있는 주석에서 가져옵니다.- MikroORM 개념 지원
Embeddable, Single Table Inheritance,
@Formula,EntitySchema/defineEntity()엔티티를 각각 독립된 개념으로 제대로 표현합니다.- DB 연결 불필요
MikroORM discovery로 엔티티 메타데이터를 읽습니다. SQLite, PostgreSQL, MySQL, MariaDB 드라이버에서 MikroORM 6과 7 모두 동작합니다.