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,4 +1,4 @@
import { Entity, ManyToOne, Unique } from '@mikro-orm/core';
import { Entity, Index, ManyToOne, Unique } from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
import { Role } from '../../roles/entities/role.entity';
import { Restaurant } from 'src/modules/restaurants/entities/restaurant.entity';
@@ -6,6 +6,9 @@ import { Admin } from './admin.entity';
@Entity({ tableName: 'admin_roles' })
@Unique({ properties: ['admin', 'restaurant'] })
@Index({ properties: ['admin', 'restaurant'] })
@Index({ properties: ['admin'] })
@Index({ properties: ['restaurant'] })
export class AdminRole extends BaseEntity {
@ManyToOne(() => Admin)
admin!: Admin;