New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(entity-generator): use table name instead of class name in EntitySchema
#3916
Conversation
@@ -42,7 +42,7 @@ export class EntitySchemaSourceFile extends SourceFile { | |||
ret += ` class: ${this.meta.className},\n`; | |||
|
|||
if (this.meta.collection !== this.namingStrategy.classToTableName(this.meta.className)) { | |||
ret += ` tableName: ${this.quote(this.meta.className)},\n`; | |||
ret += ` tableName: ${this.quote(this.meta.tableName)},\n`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meta.tableName
is an alias for meta.collection
, i'd like to use the same in the condition on line 44 as well, to reduce confusion. i dont mind using meta.tableName
on both places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. applied the same check at L44 now.
@@ -151,6 +151,23 @@ describe('EntityGenerator', () => { | |||
await orm.close(true); | |||
}); | |||
|
|||
test('table name with underscore using entitySchema [mysql]', async () => { | |||
const orm = await initORMMySql('mysql', {entityGenerator: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this passing the linter? :] i dont think so, the indents on following lines are also wrong
const orm = await initORMMySql('mysql', {entityGenerator: { | |
const orm = await initORMMySql('mysql', { entityGenerator: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true that. i didn't run lint from my local
EntitySchema
Codecov ReportBase: 99.80% // Head: 99.80% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #3916 +/- ##
=======================================
Coverage 99.80% 99.80%
=======================================
Files 214 214
Lines 13651 13651
Branches 3189 3189
=======================================
Hits 13625 13625
Misses 24 24
Partials 2 2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Thanks! |
Closes #3915