loopbackio / loopbackio/loopback-connector-postgresql

Properties with underscores in their name cannot be indexed

オープン
#462 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug good first issue help wanted
主要言語
JavaScript
スター
118
フォーク
184
平均マージ
1日 22時間
マージ済み PR(30日)
5

説明

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)$');

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

migration.js の 777 行目付近から始め、アンダースコアを含むプロパティを使って報告されたモデル設定を再現し、その後 pg.autoupdate() を呼び出します。マイグレーション後も既存のインデックスが残っていること、およびプロパティ名にアンダースコアが含まれている場合に正しく照合されることを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, postgresql
領域
databases
issue の種類
バグ
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。