add index

This commit is contained in:
2025-12-11 18:37:50 +03:30
parent a54e8eb9f3
commit 49ec05b410
12 changed files with 42 additions and 11 deletions
@@ -1,9 +1,11 @@
import { Entity, Property, Collection, OneToMany, ManyToOne } from '@mikro-orm/core';
import { Entity, Index, Property, Collection, OneToMany, ManyToOne } from '@mikro-orm/core';
import { Food } from './food.entity';
import { BaseEntity } from '../../../common/entities/base.entity';
import { Restaurant } from 'src/modules/restaurants/entities/restaurant.entity';
@Entity({ tableName: 'categories' })
@Index({ properties: ['restaurant', 'isActive'] })
@Index({ properties: ['isActive'] })
export class Category extends BaseEntity {
@Property()
title!: string;
+4 -1
View File
@@ -1,10 +1,13 @@
import { Cascade, Collection, Entity, ManyToOne, OneToMany, Property } from '@mikro-orm/core';
import { Cascade, Collection, Entity, Index, ManyToOne, OneToMany, Property } from '@mikro-orm/core';
import { Category } from './category.entity';
import { BaseEntity } from '../../../common/entities/base.entity';
import { Restaurant } from '../../../modules/restaurants/entities/restaurant.entity';
import { Review } from 'src/modules/review/entities/review.entity';
@Entity({ tableName: 'foods' })
@Index({ properties: ['restaurant', 'isActive'] })
@Index({ properties: ['category', 'isActive'] })
@Index({ properties: ['isActive'] })
export class Food extends BaseEntity {
@ManyToOne(() => Restaurant)
restaurant: Restaurant;