I create a table. That table has composite primary key consist from 2 columns. On both columns, I use @Column({ primary: true }). It creates a table with sufficiently formed primary key.
CREATE TABLE "available_for_launch_testing" (
"abstract_testing_id" integer NOT NULL,
"educational_space_id" integer NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
CONSTRAINT "PK_54a12fbdc9989bd921c8cbb4372" PRIMARY KEY ("abstract_testing_id", "educational_space_id")
)
CREATE INDEX "IDX_f7d26e320ec68f35ccf8ce14be" ON "available_for_launch_testing" ("educational_space_id")
CREATE INDEX "IDX_3d00e8bc90bc12c19a824ade7b" ON "available_for_launch_testing" ("abstract_testing_id")
The problem is that it produces two indexes instead of one.
CREATE UNIQUE INDEX "IDX_54a12fbdc9989bd921c8cbb437" ON "available_for_launch_testing" ("abstract_testing_id", "educational_space_id")
It is exactly what I want!
But those 2 indexes are still here. And I didn't find the way to remove them. If I remove them, they appear in the next migration. I tried to blacklist them by
Bug Report
Current behavior
I create a table. That table has composite primary key consist from 2 columns. On both columns, I use
@Column({ primary: true })
. It creates a table with sufficiently formed primary key.It produces migration like that:
The problem is that it produces two indexes instead of one.
I also tried to add multicolumn index manually by
and it added this index
It is exactly what I want!
But those 2 indexes are still here. And I didn't find the way to remove them. If I remove them, they appear in the next migration. I tried to blacklist them by
But it looks like it has no effect for that case.
Expected behavior
Using composite primary key causes multicolumn index creation. And because it is primary key as a consequence index should be unique.
Environment