fix(cli): validate migration name and correctly report created migration files#4103
Open
Muawiya-contact wants to merge 1 commit into
Open
fix(cli): validate migration name and correctly report created migration files#4103Muawiya-contact wants to merge 1 commit into
Muawiya-contact wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes issues in the scripts/cli migration helper commands by adding basic argument validation and correcting the final “created” output so it reports the actual migration files created.
Changes:
- Add required-argument validation for migration name in
create_migration()andcreate_product_migration(). - Quote migration file paths in
touchcalls to handle paths safely. - Fix the final output message to reference
$UP_MIG_FILEand$DOWN_MIG_FILE(instead of undefined$MIG_FILE).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0525e7d to
365067f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 365067f. Configure here.
…ion files Signed-off-by: Muawiya-contact <contactmuawia@gmail.com>
365067f to
a32a0f3
Compare
Comment on lines
+296
to
+299
| MIG_NAME="$(printf '%s\n' "$1" | tr -s ' ' | xargs)" | ||
| if [[ -z "$MIG_NAME" ]] || [[ ! "$MIG_NAME" =~ ^[A-Za-z0-9_-]+$ ]]; then | ||
| error "Migration name must be non-empty and contain only letters, numbers, underscores, or hyphens" | ||
| exit 1 |
Comment on lines
+311
to
+314
| MIG_NAME="$(printf '%s\n' "$1" | tr -s ' ' | xargs)" | ||
| if [[ -z "$MIG_NAME" ]] || [[ ! "$MIG_NAME" =~ ^[A-Za-z0-9_-]+$ ]]; then | ||
| error "Migration name must be non-empty and contain only letters, numbers, underscores, or hyphens" | ||
| exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Two bugs in
scripts/climigration helpers:$MIG_FILEis printed in final output but never definedsilently creates broken files like
V123456__ .sqltouchcallsFix
$UP_MIG_FILEand$DOWN_MIG_FILEintouchcallsFiles Changed
scripts/cliCloses #4102
Note
Low Risk
Low risk shell-script change limited to migration helper commands; main impact is stricter validation that may reject previously accepted (invalid) names.
Overview
Improves
scripts/climigration helpers by sanitizing and validating the migration name (trim/collapse spaces, require[A-Za-z0-9_-]+) and failing fast with a clear error message.Fixes robustness issues by quoting generated migration paths in
touchcalls and correcting the final output to print the actualV...andU...files created (instead of an undefined$MIG_FILE).Reviewed by Cursor Bugbot for commit a32a0f3. Bugbot is set up for automated code reviews on this repo. Configure here.