mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-09 22:57:24 +00:00
Merge pull request #401 from SyncrowIOT/fix-log-insert-error
Refactor DeviceStatusLogEntity: update unique constraint to include d…
This commit is contained in:
@ -2,15 +2,15 @@ import { SourceType } from '@app/common/constants/source-type.enum';
|
||||
import { Entity, Column, PrimaryColumn, Unique } from 'typeorm';
|
||||
|
||||
@Entity('device-status-log')
|
||||
@Unique('event_time_idx', ['eventTime'])
|
||||
@Unique('event_time_idx', ['eventTime', 'deviceId'])
|
||||
export class DeviceStatusLogEntity {
|
||||
@Column({ type: 'int', generated: true, unsigned: true })
|
||||
@PrimaryColumn({ type: 'int', generated: true, unsigned: true })
|
||||
id: number;
|
||||
|
||||
@Column({ type: 'text' })
|
||||
eventId: string;
|
||||
|
||||
@PrimaryColumn({ type: 'timestamptz' })
|
||||
@Column({ type: 'timestamptz' })
|
||||
eventTime: Date;
|
||||
|
||||
@Column({
|
||||
|
Reference in New Issue
Block a user