import { defineEntity, p } from '@mikro-orm/core';

export class MeetingUser {
  id!: bigint;
  longUserId!: bigint;
  createdAt?: Date;
}

export const MeetingUserSchema = defineEntity({
  class: MeetingUser,
  uniques: [{ name: 'idx_hostUserId', properties: ['longUserId'] }],
  properties: {
    id: p.bigint().primary().unsigned(false).comment('短id'),
    longUserId: p.bigint().name('long_user_Id').comment('用户的uid').unique('hostUserId'),
    createdAt: p.datetime().length(3).nullable().comment('创建时间').defaultRaw(`current_timestamp(3)`),
  },
});
