Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Properties with underscores in their name cannot be indexed

未关闭
#462 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
javascript, postgresql
领域
databases

调研方向

从 migration.js 大约第 777 行开始,使用包含下划线的属性复现报告中的模型设置,然后调用 pg.autoupdate()。验证现有索引在迁移后仍然保留,并确认属性名称包含下划线时能够正确匹配。

由索引模型根据 Issue 内容生成。

描述

bug good first issue help wanted

Steps to reproduce

  1. create a model with a property name that contains an underscore in it (e.g. short_name).
  2. set that property to be indexed (e.g. "index": true)
  3. call pg.autoupdate() (e.g. where app.datasources.pg);

Current Behavior

  1. The index is added
  2. Then the index is dropped

Expected Behavior

  1. The index is added

Additional information

The bug shown here is a bad regular expression in migration.js (on or about line 777):
const propNameRegEx = new RegExp('^' + self.table(model) + '_([^_]+)_idx');

The simple fix is:
const propNameRegEx = new RegExp('^' + self.table(model) + '_(.*)(?:_idx)$');

主要语言
JavaScript
星标
118
派生
183
平均合并
3 天 7 小时
30 天内合并 PR
9

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

loopbackio/loopback-connector-postgresql 的其他 Issue

查看 loopbackio/loopback-connector-postgresql 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。