schema generates wrong index

Ccharli5/12/2023
I have this schema:

export const historyFiles = pgTable('history_files', {
  id: serial('id').primaryKey(),
  fileId: integer('file_id')
    .references(() => files.id)
    .notNull(),
  historyId: integer('history_id')
    .references(() => histories.id)
    .notNull(),

  createdAt: timestamp('created_at').defaultNow().notNull(),
  updatedAt: timestamp('updated_at').defaultNow().notNull(),
});


why is creating a composite index like: history_files_file_id_users_id_fk
ASAndrii Sherman5/12/2023
can you show whole schema file? so I can generate it on my end?
ASAndrii Sherman5/12/2023
also would be great if you can share kit and orm versions
Ccharli5/13/2023
export const histories = pgTable('histories', {
  id: serial('id').primaryKey(),
  medicalHistoryNumber: text('medical_history_number').notNull(),
  doctor: text('doctor').notNull(),
  division: text('division').notNull(),
  comments: text('comments').notNull(),
  date: timestamp('date').notNull(),
  type: historyTypeEnum('type').notNull(),
  state: historyStateEnum('state').notNull(),
  creatorId: integer('creator_id')
    .references(() => users.id)
    .notNull(),

  hospitalId: integer('hospital_id')
    .references(() => organizations.id)
    .notNull(),
  providerId: integer('provider_id')
    .references(() => organizations.id)
    .notNull(),

  createdAt: timestamp('created_at').defaultNow().notNull(),
  updatedAt: timestamp('updated_at').defaultNow().notNull(),
});

export const historyFiles = pgTable('history_files', {
  id: serial('id').primaryKey(),
  fileId: integer('file_id')
    .references(() => files.id)
    .notNull(),
  historyId: integer('history_id')
    .references(() => histories.id)
    .notNull(),

  createdAt: timestamp('created_at').defaultNow().notNull(),
  updatedAt: timestamp('updated_at').defaultNow().notNull(),
});

export const files = pgTable('files', {
  id: serial('id').primaryKey(),
  filename: text('filename').notNull(),
  key: text('key').notNull(),
  uploadedBy: integer('uploaded_by')
    .references(() => users.id)
    .notNull(),
  createdAt: timestamp('created_at').defaultNow().notNull(),
  updatedAt: timestamp('updated_at').defaultNow().notNull(),
});
Ccharli5/13/2023
"drizzle-orm": "^0.23.13",
"drizzle-kit": "^0.17.4",