UNPKG

@mikro-orm/core

Version:

TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.

26 lines (25 loc) 901 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MongoNamingStrategy = void 0; const AbstractNamingStrategy_1 = require("./AbstractNamingStrategy"); class MongoNamingStrategy extends AbstractNamingStrategy_1.AbstractNamingStrategy { classToTableName(entityName) { return entityName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); } joinColumnName(propertyName) { return propertyName; } joinKeyColumnName(entityName, referencedColumnName) { return entityName; } joinTableName(sourceEntity, targetEntity, propertyName) { return this.classToTableName(sourceEntity) + '_' + this.propertyToColumnName(propertyName); } propertyToColumnName(propertyName) { return propertyName; } referenceColumnName() { return '_id'; } } exports.MongoNamingStrategy = MongoNamingStrategy;