使用typeorm,我连接到mysql数据库。数据库中已存在多个表。我尝试使用entity模块来描述一个表,但我的定义覆盖了现有的表。如何从现有的表中完全继承实体?
import "reflect-metadata";
import { Entity, PrimaryGeneratedColumn, Column, PrimaryColumn, OneToMany } from "typeorm";
@Entity("devices")
export class Devices {
@PrimaryGeneratedColumn()
ID: number;
@Column({ type: "varchar", length: 255 })
Name: string;
@Column({ type: "int", nullable: false })
DevID: number;
@Column({ type: "int", nullable: false })
Longtitude: number;
@Column({ type: "int", nullable: false })
Latitude: number;
@PrimaryColumn({ type: "varchar", length: 255 })
URL_VWS: string;
}发布于 2020-05-28 14:29:36
您可以使用@Entity将synchronize属性设置为false,如下所示。
@Entity({name:"devices", synchronize: false})https://stackoverflow.com/questions/59049046
复制相似问题