-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,492 additions
and
1,838 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { PrimaryKey, Property } from '@mikro-orm/core'; | ||
import { Opt, PrimaryKey, Property } from '@mikro-orm/core'; | ||
|
||
export abstract class BaseEntity { | ||
|
||
@PrimaryKey() | ||
id!: number; | ||
|
||
@Property() | ||
createdAt: Date = new Date(); | ||
createdAt: Date & Opt = new Date(); | ||
|
||
@Property({ onUpdate: () => new Date() }) | ||
updatedAt: Date = new Date(); | ||
updatedAt: Date & Opt = new Date(); | ||
|
||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import { Logger } from '@nestjs/common'; | ||
import { Options } from '@mikro-orm/core'; | ||
import { SqlHighlighter } from '@mikro-orm/sql-highlighter'; | ||
import { defineConfig } from '@mikro-orm/mysql'; | ||
import { Author, BaseEntity, Book, BookTag, Publisher } from './entities'; | ||
|
||
const logger = new Logger('MikroORM'); | ||
const config: Options = { | ||
|
||
export default defineConfig({ | ||
entities: [Author, Book, BookTag, Publisher, BaseEntity], | ||
dbName: 'mikro-orm-nest-ts', | ||
type: 'mysql', | ||
port: 3307, | ||
highlighter: new SqlHighlighter(), | ||
debug: true, | ||
logger: logger.log.bind(logger), | ||
}; | ||
|
||
export default config; | ||
}); |
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
Oops, something went wrong.