Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sequelize): get table name dynamically
based on name provided in @model decorator or fallback to lowercase for postgres to match loopback connector's behaviour Signed-off-by: Shubham P <shubham.prajapat@sourcefuse.com>
- Loading branch information
1 parent
311e97f
commit 2a7ca80
Showing
3 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
extensions/sequelize/src/__tests__/fixtures/models/test.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {Entity, model} from '@loopback/repository'; | ||
|
||
export const eventTableName = 'tbl_event'; | ||
@model({ | ||
name: eventTableName, | ||
}) | ||
export class Event extends Entity { | ||
// No properties are needed, This model is just used for testing the table names | ||
|
||
constructor(data?: Partial<Event>) { | ||
super(data); | ||
} | ||
} | ||
|
||
@model() | ||
export class Box extends Entity { | ||
// No properties are needed, This model is just used for testing the table names | ||
|
||
constructor(data?: Partial<Box>) { | ||
super(data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters