Skip to content

Commit

Permalink
feat(mongo): simplify id
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Dec 25, 2023
1 parent ca73804 commit d7b5154
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/commands/MakeModelCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/

import { Path, File } from '@athenna/common'
import { Path } from '@athenna/common'
import { sep, resolve, isAbsolute } from 'node:path'
import { BaseCommand, Argument } from '@athenna/artisan'

Expand Down
4 changes: 2 additions & 2 deletions src/models/annotations/Column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ export function Column(
options.isPrimary = true
}

const Target = target.constructor

const connection = Target.connection()
const driver = Config.get(`database.connections.${connection}.driver`)

if (!hasSetName && options.name === 'id' && driver === 'mongo') {
options.name = '_id'
}

const Target = target.constructor

debug('registering column metadata for model %s: %o', Target.name, options)

Annotation.defineColumnMeta(Target, options)
Expand Down

0 comments on commit d7b5154

Please sign in to comment.