Npm run migrate - (Strange bug) - Foreign Key Constraint did not get generate after undoing @loopback/authentication implementation.
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- javascript, node.js, postgresql
- 領域
- database
調査の方向性
認証の実装を元に戻した後、PostgreSQL と DEBUG=loopback:* npm run migrate を使用して Todo/TodoList SQL データベースチュートリアルのマイグレーションを再現します。マイグレーションの出力を、issue で期待されている外部キーの ALTER TABLE 文と比較します。制約が省略される理由を特定するか、再現可能な環境またはセットアップの違いに原因を絞り込めれば完了です。
索引モデルが issue の本文から書いたものです。
説明
https://github.com/loopbackio/loopback-next/issues/5709
As per above, when I was doing code debugging with JSON Web token Authentication feature for the Todo and TodoList tutorial yesterday, and I realised that I couldn't get far in making the user and user credential models to perform database migraiton, I decided to undo this feature and wanted to roll back my local features and revert back my working Todo and TodoList models database migraiton.
When performing the steps from this page all over again - https://loopback.io/doc/en/lb4/todo-list-tutorial-sqldb.html
I found the foreign key constraints for my Todo/TodoList table/model did not generate in my postgres database.
I was puzzled why it happened until I ran the following
DEBUG=loopback:* npm run migrate
In the logs, I was expecting the following entries to appear in the logs:
loopback:connector:postgresql SQL: ALTER TABLE "public"."todo" ADD CONSTRAINT "fk_todo_todoListId" FOREIGN KEY ("todolistid") REFERENCES "public"."todolist"(id) ON DELETE NO ACTION ON UPDATE NO ACTION +1ms
loopback:connector:postgresql:data {"command":"ALTER","rowCount":null,"oid":null,"rows":[],"fields":[],"_types":{"_types":{"arrayParser":{},"builtins":{"BOOL":16,"BYTEA":17,"CHAR":18,"INT8":20,"INT2":21,"INT4":23,"REGPROC":24,"TEXT":25,"OID":26,"TID":27,"XID":28,"CID":29,"JSON":114,"XML":142,"PG_NODE_TREE":194,"SMGR":210,"PATH":602,"POLYGON":604,"CIDR":650,"FLOAT4":700,"FLOAT8":701,"ABSTIME":702,"RELTIME":703,"TINTERVAL":704,"CIRCLE":718,"MACADDR8":774,"MONEY":790,"MACADDR":829,"INET":869,"ACLITEM":1033,"BPCHAR":1042,"VARCHAR":1043,"DATE":1082,"TIME":1083,"TIMESTAMP":1114,"TIMESTAMPTZ":1184,"INTERVAL":1186,"TIMETZ":1266,"BIT":1560,"VARBIT":1562,"NUMERIC":1700,"REFCURSOR":1790,"REGPROCEDURE":2202,"REGOPER":2203,"REGOPERATOR":2204,"REGCLASS":2205,"REGTYPE":2206,"UUID":2950,"TXID_SNAPSHOT":2970,"PG_LSN":3220,"PG_NDISTINCT":3361,"PG_DEPENDENCIES":3402,"TSVECTOR":3614,"TSQUERY":3615,"GTSVECTOR":3642,"REGCONFIG":3734,"REGDICTIONARY":3769,"JSONB":3802,"REGNAMESPACE":4089,"REGROLE":4096}},"text":{},"binary":{}},"RowCtor":null,"rowAsArray":false,"_prebuiltEmptyResultObject":null} +4m
But that ALTER TABLE "public"."todo" ADD CONSTRAINT "fk_todo_todoListId" FOREIGN KEY ("todolistid") REFERENCES "public"."todolist"(id) ON DELETE NO ACTION ON UPDATE NO ACTION did not show up at all.
I teared down the database, recreated it again, run npm run migrate. I still ended with the same result.
I even restarted my Postgres DB and my machine, performed the steps all over again - the same problem persists.
Out of frustration, I decided to recreate my loopback app from scratch again, and peform the db models migration again - just to help to regain my sanity back ensuring that I didn't do anything else silly that caused all this unexplained confusion. Sure enough the foreigh key constraint creation through the npm run migrate works this time around.
Thus I want to understand this - does importing @loopback/authentication models and tables feature cause the foreign key constraint script migraiton to stop working all of the sudden? Or is it purely coincidental it could be a random environment issue?
- 主要言語
- JavaScript
- スター
- 118
- フォーク
- 183
- 平均マージ
- 3日 7時間
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
loopbackio/loopback-connector-postgresql のほかの issue
-
Partial JSON Update対応中かも @vaibhavbhalla2505 が 263 日前に担当しました。 オープンfeature
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
loopbackio/loopback-connector-postgresql#748 · コメント 1 件 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
loopbackio/loopback-connector-postgresql#732 · コメント 1 件 ·
-
feature
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
loopbackio/loopback-connector-postgresql の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
druxt/umami.demo.druxtjs.org#527 ·
メンテナーはふだん 9 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
NuSkooler/enigma-bbs#907 ·
メンテナーはふだん 1 日以内に返信
-
documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
documentation good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信