typeorm#Index TypeScript Examples

The following examples show how to use typeorm#Index. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: regions.entity.ts    From aqualink-app with MIT License 6 votes vote down vote up
@ApiPointProperty()
  @Column({
    type: 'geometry',
    unique: true,
    srid: 4326,
    nullable: false,
  })
  @Index({ spatial: true })
  polygon: GeoJSON | null;
Example #2
Source File: ProductMeta.ts    From typeorm-uml with MIT License 6 votes vote down vote up
@Index( 'uq_product_meta', [ 'productId', 'key' ], { unique: true } )
@Index( 'idx_meta_product', [ 'productId' ], {} )
@Entity( 'product_meta', { schema: 'shop' } )
export class ProductMeta {

	@PrimaryGeneratedColumn( { type: 'bigint', name: 'id' } )
	id: string;

	@Column( 'bigint', { name: 'productId' } )
	productId: string;

	@Column( 'varchar', { name: 'key', length: 50 } )
	key: string;

	@Column( 'text', { name: 'content', nullable: true } )
	content: string | null;

	@ManyToOne( () => Product, ( product ) => product.productMetas, {
		onDelete: 'RESTRICT',
		onUpdate: 'RESTRICT',
	} )
	@JoinColumn( [ { name: 'productId', referencedColumnName: 'id' } ] )
	product: Product;

}
Example #3
Source File: user.ts    From MyAPI with MIT License 6 votes vote down vote up
@ApiProperty({ description: 'Email' })
  @Column({ type: 'varchar', length: 50 })
  @Index('IDX_USER_EMAIL', { unique: true })
  @IsEmail({}, {
    message: 'The email is not valid'
  })
  @IsNotEmpty({
    message: 'Email is required'
  })
  email: string
Example #4
Source File: metadata.base.entity.ts    From nestjs-starter with MIT License 6 votes vote down vote up
export function BaseEntityMetadata<TBase extends Constructor>(Base: TBase) {
  abstract class AbstractBase extends Base {
    @ApiProperty()
    @Index()
    @Column({ type: 'varchar', length: 255, nullable: true })
    key!: string;

    @ApiProperty()
    @Column({ type: 'text', nullable: true })
    value?: string;
  }

  return AbstractBase;
}
Example #5
Source File: Chapter.ts    From pknote-backend with GNU General Public License v3.0 6 votes vote down vote up
@Index('chapter_pkey', ['columnId'], { unique: true })
@Entity('chapter', { schema: 'public' })
export class Chapter {
  @Column('character varying', { primary: true, name: 'column_id', length: 36 })
  columnId: string;

  @Column('character varying', {
    name: 'chapter_id',
    nullable: true,
    length: 36,
  })
  chapterId: string | null;

  @Column('character varying', {
    name: 'chapter_name',
    nullable: true,
    length: 255,
  })
  chapterName: string | null;

  @Column('numeric', { name: 'price', nullable: true, precision: 10, scale: 2 })
  price: string | null;

  @Column('character varying', {
    name: 'parent_id',
    nullable: true,
    length: 36,
  })
  parentId: string | null;

  @Column('integer', { name: 'creator_user_id', nullable: true })
  creatorUserId: number | null;
}
Example #6
Source File: mcaEligibility.ts    From Corsace with MIT License 5 votes vote down vote up
@Index()
    @Column({ type: "year" })
    year!: number;
Example #7
Source File: attribute-product.entity.ts    From Cromwell with MIT License 5 votes vote down vote up
@Field(type => Int, { nullable: true })
    @Column("int", { nullable: true })
    @Index()
    productId: number;
Example #8
Source File: Activity.ts    From context-mod with MIT License 5 votes vote down vote up
@Index({unique: true})
    @Column("text")
    permalink!: string;
Example #9
Source File: user.entity.ts    From nest-js-boilerplate with MIT License 5 votes vote down vote up
@ApiProperty({ type: String, maxLength: 64 })
  @Column({ length: 64 })
  @Index({ unique: true })
  readonly email: string = '';
Example #10
Source File: Project.ts    From barista with Apache License 2.0 5 votes vote down vote up
@ApiProperty()
  @Column({ type: 'text', default: '', nullable: false, width: 64 })
  @Index('project_user_idx1')
  userId: string;
Example #11
Source File: CashBudgetSplit.ts    From cashcash-desktop with MIT License 5 votes vote down vote up
@Column({ name: 'transactionDate', type: 'datetime' })
    @Index()
    transactionDate: Date;
Example #12
Source File: site-audit.entity.ts    From aqualink-app with MIT License 5 votes vote down vote up
@Index()
  @Column()
  oldValue: string;
Example #13
Source File: ChatMessage.entity.ts    From bouncecode-cms with GNU General Public License v3.0 5 votes vote down vote up
@Column()
  @Index()
  roomId: string;
Example #14
Source File: user.ts    From crossfeed with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@Index({ unique: true })
  @Column({
    nullable: true
  })
  cognitoId: string;
Example #15
Source File: CourseGuest.ts    From backend with MIT License 5 votes vote down vote up
@Index({ unique: true })
    @Column({
        nullable: false
    })
    token: string;