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

export class MeetingUser {
  id!: IType<number, bigint>;
  longUserId!: IType<number, bigint>;
  createdAt?: Date;
}

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