[Fix] sponsorship_activities マイグレーションの型不一致を修正#1055
Conversation
Summary of ChangesHello @TkymHrt, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! このプルリクエストは、データベースのスキーマにおける型不一致の問題を解決します。 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
このプルリクエストは、sponsorship_activities関連のマイグレーションにおけるカラムの型をINTからINT UNSIGNEDに修正するもので、参照先テーブルの型と一致させるための重要な修正です。変更内容は正しい方向性ですが、いくつか改善点があります。
第一に、データの整合性を保証するために、マイグレーションファイルに外部キー制約を追加することを強く推奨します。リポジトリ内の他のマイグレーションファイルでは外部キーが定義されており、それに倣うべきです。
第二に、データベースの型がINT UNSIGNEDに変更されたにもかかわらず、関連するGoのドメインモデルでは符号付きのint型が使用され続けています。IDが2,147,483,647を超えた場合にオーバーフローを引き起こす可能性があるため、Goの型もuintなどに更新することをお勧めします。この点は変更範囲外のファイルに関する指摘のため、全体コメントにて失礼します。
…UTFes/FinanSu into fix/migration-foreign-key-type
Deploying finansu with
|
| Latest commit: |
3f11d94
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://77f021cc.finansu.pages.dev |
| Branch Preview URL: | https://fix-migration-foreign-key-ty.finansu.pages.dev |
|
型合わせ助かります。 |
対応Issue
resolve #0概要
参照先のテーブル(
sponsors,users,sponsor_styles等)の主キーがINT UNSIGNEDで定義されているのに対して、マイグレーションファイルではINTで定義されていたため、カラムの型をINTからINT UNSIGNEDに変更しました。外部キー制約を追加
画面スクリーンショット等
URLスクリーンショット
テスト項目
make del-dbでボリュームを削除した状態からmake run-allが正常に完走することを確認。create_sponsorship_activitiesが成功していることを確認。備考
関連: #1048