运行使用TypeORM的服务器时出现此错误-有人知道我为什么收到此错误吗?
(node:24695) [DEP0095] DeprecationWarning: timers.enroll() is deprecated. Please use setTimeout instead.
(node:24695) [DEP0096] DeprecationWarning: timers.unenroll() is deprecated. Please use clearTimeout instead.
unhandledRejection { MissingPrimaryColumnError: Entity "Provider" does not have a primary column. Primary column is required to have in all your entities. Use @PrimaryColumn decorator to add a primary column to your entity.
at new MissingPrimaryColumnError (/home/oleg/WebstormProjects/moove/moove-api-mariadb/node_modules/typeorm/error/MissingPrimaryColumnError.js:18:28)
at EntityMetadataValidator.validate (/home/oleg/WebstormProjects/moove/moove-api-mariadb/node_modules/typeorm/metadata-builder/EntityMetadataValidator.js:51:19)
at /home/oleg/WebstormProjects/moove/moove-api-mariadb/node_modules/typeorm/metadata-builder/EntityMetadataValidator.js:41:74
at Array.forEach (<anonymous>)
at EntityMetadataValidator.validateMany (/home/oleg/WebstormProjects/moove/moove-api-mariadb/node_modules/typeorm/metadata-builder/EntityMetadataValidator.js:41:25)
at Connection.buildMetadatas (/home/oleg/WebstormProjects/moove/moove-api-mariadb/node_modules/typeorm/connection/Connection.js:515:33)
at Connection.<anonymous> (/home/oleg/WebstormProjects/moove/moove-api-mariadb/node_modules/typeorm/connection/Connection.js:162:30)
at step (/home/oleg/WebstormProjects/moove/moove-api-mariadb/node_modules/typeorm/connection/Connection.js:32:23)
at Object.next (/home/oleg/WebstormProjects/moove/moove-api-mariadb/node_modules/typeorm/connection/Connection.js:13:53)
at fulfilled (/home/oleg/WebstormProjects/moove/moove-api-mariadb/node_modules/typeorm/connection/Connection.js:4:58)
name: 'MissingPrimaryColumnError',
message:
'Entity "Provider" does not have a primary column. Primary column is required to have in all your entities. Use @PrimaryColumn decorator to add a primary column to your entity.' }
这是模型:
'use strict';
import {Column, Entity, Index, PrimaryColumn, PrimaryGeneratedColumn} from "typeorm";
@Entity()
@Index(["emailPrimary"], { unique: true })
@Index(["emailSecondary"], { unique: true })
@Index(["companyName"], { unique: true })
export class Provider {
@PrimaryGeneratedColumn()
id: number;
@Column()
companyName: string;
@Column()
pin: string; // 6 digit pin
@Column()
emailPrimary: string;
}
有人知道我为什么收到该错误吗?