Closed maflohr closed 1 year ago
Describe the bug Codegen does not include typeorm's Index as Index_ when only using multi-column indices.
typeorm
Index as Index_
To Reproduce Steps to reproduce the behavior:
Clone the squid-substrate-template repository
npm run update && npm ci
Edit the schema.graphql to only include the following lines
type AliceBob @entity @index(fields: ["alice", "bob"]) { alice: String! bob: String! }
Run sqd codegen
sqd codegen
See that the src/model/generated/aliceBob.model.ts uses the unreferenced @Index_ decorator
@Index_
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_} from "typeorm"
@Index(["alice", "bob"], {unique: false}) @Entity() export class AliceBob { ...
**Expected behavior** The `Index as Index_` import should be added to the generated model.
import {Entity as Entity, Column as Column, PrimaryColumn as PrimaryColumn, Index as Index} from "typeorm"
**Environment (please complete the following information):** - @subsquid/cli (2.1.0) - node.js v16.16.0 - npm 9.4.1 - OS Ubuntu 20.04.5 LTS, 5.10.102.1-microsoft-standard-WSL2
Describe the bug Codegen does not include
typeorm
'sIndex as Index_
when only using multi-column indices.To Reproduce Steps to reproduce the behavior:
Clone the squid-substrate-template repository
npm run update && npm ci
Edit the schema.graphql to only include the following lines
Run
sqd codegen
See that the src/model/generated/aliceBob.model.ts uses the unreferenced
@Index_
decorator@Index(["alice", "bob"], {unique: false}) @Entity() export class AliceBob { ...
import {Entity as Entity, Column as Column, PrimaryColumn as PrimaryColumn, Index as Index} from "typeorm"
@Index(["alice", "bob"], {unique: false}) @Entity() export class AliceBob { ...