Skip to content

Commit

Permalink
add indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Dec 19, 2024
1 parent 69d14ad commit dcd6996
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
BaseEntity,
Column,
Entity,
Index,
ManyToOne,
PrimaryGeneratedColumn,
} from 'typeorm';
Expand Down Expand Up @@ -31,17 +32,20 @@ export class IndicatorCoefficient extends BaseEntity {
@Column({ type: 'int' })
year!: number;

@Index()
@ManyToOne(() => AdminRegion, (ar: AdminRegion) => ar.indicatorCoefficients, {
nullable: true,
})
adminRegion: AdminRegion;

@Index()
@ManyToOne(
() => Indicator,
(indicator: Indicator) => indicator.indicatorCoefficients,
)
indicator!: Indicator;

@Index()
@ManyToOne(() => Material, (mat: Material) => mat.indicatorCoefficients)
material!: Material;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
Check,
Column,
Entity,
In,
Index,
JoinColumn,
ManyToOne,
Expand Down Expand Up @@ -136,6 +137,7 @@ export class SourcingLocation extends TimestampedBaseEntity {
material: Material;

@ApiPropertyOptional()
@Index('sourcing_location_material_id_index')
@Column()
materialId: string;

Expand All @@ -147,6 +149,7 @@ export class SourcingLocation extends TimestampedBaseEntity {
adminRegion: AdminRegion;

@Column({ nullable: true })
@Index('sourcing_location_admin_region_id_index')
@ApiPropertyOptional()
adminRegionId: string;

Expand Down

0 comments on commit dcd6996

Please sign in to comment.