diff options
Diffstat (limited to 'util/src/entities/BaseClass.ts')
-rw-r--r-- | util/src/entities/BaseClass.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/util/src/entities/BaseClass.ts b/util/src/entities/BaseClass.ts index d18757f2..f105086a 100644 --- a/util/src/entities/BaseClass.ts +++ b/util/src/entities/BaseClass.ts @@ -5,10 +5,8 @@ import { BeforeUpdate, EntityMetadata, FindConditions, - getConnection, - getManager, + ObjectIdColumn, PrimaryColumn, - RemoveOptions, } from "typeorm"; import { Snowflake } from "../util/Snowflake"; import "missing-native-js-functions"; @@ -117,8 +115,10 @@ export class BaseClassWithoutId extends BaseEntity { // } } +export const PrimaryIdColumn = process.env.DATABASE?.startsWith("mongodb") ? ObjectIdColumn : PrimaryColumn; + export class BaseClass extends BaseClassWithoutId { - @PrimaryColumn() + @PrimaryIdColumn() id: string; assign(props: any = {}) { |