-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Labels
Description
Issue type:
[X] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[X] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[X] latest
[ ] @next
[ ] 0.x.x (or put your version here)
Steps to reproduce or a small repository showing the problem:
@Entity()
export class StationMetric {
@PrimaryColumn('uuid')
stationId: string;
@OneToOne(
() => Station,
{primary:true}
)
@JoinColumn({name: 'stationId'})
station: Station
}
The above code generates the following query:
await queryRunner.query(`CREATE TABLE "station_metric" ("stationId" uuid NOT NULL, CONSTRAINT "REL_58d69669f9e935320b59550430" UNIQUE ("stationId"), CONSTRAINT "PK_58d69669f9e935320b59550430d" PRIMARY KEY ("stationId"))`);
The Unique constrain in stationId is reductant as its the primary key. I guess its a bug, please confirm. If its a bug, willing to work on a fix for the same :)
seokgyo, michaelzangl and lusever