add index
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Entity, ManyToOne, Property, Enum, Unique } from '@mikro-orm/core';
|
||||
import { Entity, Index, ManyToOne, Property, Enum, Unique } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { Restaurant } from '../../restaurants/entities/restaurant.entity';
|
||||
import { normalizePhone } from '../../utils/phone.util';
|
||||
@@ -6,6 +6,9 @@ import { CouponType } from '../interface/coupon';
|
||||
|
||||
@Entity({ tableName: 'coupons' })
|
||||
@Unique({ properties: ['code', 'restaurant'] })
|
||||
@Index({ properties: ['restaurant', 'code', 'isActive'] })
|
||||
@Index({ properties: ['restaurant', 'isActive'] })
|
||||
@Index({ properties: ['code'] })
|
||||
export class Coupon extends BaseEntity {
|
||||
@ManyToOne(() => Restaurant)
|
||||
restaurant!: Restaurant;
|
||||
|
||||
Reference in New Issue
Block a user