Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed wrong column name #84

Merged
merged 1 commit into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose/init-scripts/initialize.sql
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ BEGIN
IF EXISTS (
SELECT FROM information_schema.columns
WHERE table_name = 'runtime_frameworks'
AND column_name = 'frame_npu_image_01'
AND column_name = 'frame_npu_image'
)
THEN
ALTER TABLE IF EXISTS runtime_frameworks
Expand Down
2 changes: 1 addition & 1 deletion docker/etc/server/initialize.sql
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ BEGIN
IF EXISTS (
SELECT FROM information_schema.columns
WHERE table_name = 'runtime_frameworks'
AND column_name = 'frame_npu_image_01'
AND column_name = 'frame_npu_image'
)
THEN
ALTER TABLE IF EXISTS runtime_frameworks
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/charts/csghub/charts/server/initialize.sql
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ BEGIN
IF EXISTS (
SELECT FROM information_schema.columns
WHERE table_name = 'runtime_frameworks'
AND column_name = 'frame_npu_image_01'
AND column_name = 'frame_npu_image'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider checking for both old and new column names during migration.

The EXISTS check only looks for the new column name frame_npu_image. This could cause issues if the script runs on a database where the column hasn't been renamed yet.

Consider modifying the check to handle both column names:

-            AND column_name = 'frame_npu_image'
+            AND column_name IN ('frame_npu_image_01', 'frame_npu_image')
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
AND column_name = 'frame_npu_image'
AND column_name IN ('frame_npu_image_01', 'frame_npu_image')

)
THEN
ALTER TABLE IF EXISTS runtime_frameworks
Expand Down