soniq icon indicating copy to clipboard operation
soniq copied to clipboard

Bug: Creating Index via Decorator seems not to work

Open davidsparkles opened this issue 6 years ago • 0 comments

Package

  • db

Describe the bug

No database index is created when using the Index decorator. see example below.

To Reproduce

The following should create an index like CREATE INDEX ON "Investment" ("projectId");, but the index is not created:

import { Entity, ManyToOne, PrimaryGeneratedColumn, BaseEntity, Index } from "@fullstack-one/db";
import { Emission } from "./Emission";

@Entity()
export default class Investment extends BaseEntity {
  @PrimaryGeneratedColumn()
  public readonly id!: string;

  @ManyToOne((type) => Emission, "investments", { nullable: false, lazy: true })
  @Index()
  public emission!: Promise<Emission>;
}

Expected behavior Index should be created.

davidsparkles avatar Nov 08 '19 09:11 davidsparkles