Strip SQL -- comments before executing migration statements#6
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
Agent-Logs-Url: https://github.com/fzed51/migration/sessions/82534706-7a22-4ff2-a3b9-45506e45b3c0 Co-authored-by: fzed51 <1201984+fzed51@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix cleanup of comments in migration scripts
Strip SQL May 26, 2026
-- comments before executing migration statements
fzed51
approved these changes
May 27, 2026
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.
When a SQL statement is commented out with
--, the migration engine was attempting to execute the comment as a query, causing a crash.Changes
src/MigrationCore.php: InexecuteQueryFile(), applypreg_replace('/--.*/', '', $line)to each non-separator line before accumulating it into the current statement. Lines that become empty after stripping are skipped entirely.test/MigrationCoreSecurityTest.php: Three new tests covering inline trailing comments, fully-commented-out query segments, and mixed comment/SQL files.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0ca86845ce43291e8f5692c7356fccf3bcf02bf4/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/HRFIQg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/vVFooF /usr/bin/composer install --no-interaction --prefer-dist(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/QCItwh /usr/bin/composer install --no-interaction git com-sebastianbergit(http block)https://api.github.com/repos/fzed51/console-options/zipball/2ff65bb78ffcd7e70ef75189a715e664e78b8fff/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/HRFIQg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/vVFooF /usr/bin/composer install --no-interaction --prefer-dist(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/QCItwh /usr/bin/composer install --no-interaction git com-sebastianbergit(http block)https://api.github.com/repos/fzed51/pdo-helper/zipball/cd1a040b53ab53a2b79d92abb8ab3ad0dd5eee82/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/HRFIQg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/vVFooF /usr/bin/composer install --no-interaction --prefer-dist(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/QCItwh /usr/bin/composer install --no-interaction git com-sebastianbergit(http block)https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6aREDACTED, pid is -1(http block)https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82REDACTED, pid is -1(http block)https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176REDACTED, pid is -1(http block)https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74REDACTED, pid is -1(http block)https://api.github.com/repos/phpstan/phpstan/zipball/8be50c3992107dc837b17da4d140fbbdf9a5c5bd/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/HRFIQg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/vVFooF /usr/bin/composer install --no-interaction --prefer-dist(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/QCItwh /usr/bin/composer install --no-interaction git com-sebastianbergit(http block)https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45eREDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/code-unit/zipball/54391c61e4af8078e5b276ab082b6d3c54c9ad64REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/comparator/zipball/2c95e1e86cb8dd41beb8d502057d1081ccc8eca9REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/environment/zipball/a5c75038693ad2e8d4b6c15ba2403532647830c4REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/exporter/zipball/70a298763b40b213ec087c51c739efcaa90bcd74REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467aREDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aaREDACTED, pid is -1(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/ZpZhMl /usr/bin/composer install --no-interaction --ignore-platform-req=ext-xdebug en git k/_temp/ghcca-no--quiet git bran�� ed04922802c15e1de5d7447b4856de949cf56^{commit}' git d92ad903^{commit} en git /home/REDACTED/.co--hard git(http block)https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9REDACTED, pid is -1(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/ZpZhMl /usr/bin/composer install --no-interaction --ignore-platform-req=ext-xdebug en git k/_temp/ghcca-no--quiet git bran�� ed04922802c15e1de5d7447b4856de949cf56^{commit}' git d92ad903^{commit} en git /home/REDACTED/.co--hard git(http block)https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2c1ed04922802c15e1de5d7447b4856de949cf56REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/2f3a64888c814fc235386b7387dd5b5ed92ad903REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/phpunit/zipball/adc7262fccc12de2b30f12a8aa0b33775d814f00REDACTED, pid is -1(http block)https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/f6458abbf32a6c8174f8f26261475dc133b3d9dc/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/HRFIQg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/vVFooF /usr/bin/composer install --no-interaction --prefer-dist(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/QCItwh /usr/bin/composer install --no-interaction git com-sebastianbergit(http block)https://api.github.com/repos/sebastianbergmann/type/zipball/f77d2d4e78738c98d9a68d2596fe5e8fa380f449/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/HRFIQg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/vVFooF /usr/bin/composer install --no-interaction --prefer-dist(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/QCItwh /usr/bin/composer install --no-interaction git com-sebastianbergit(http block)https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/HRFIQg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/vVFooF /usr/bin/composer install --no-interaction --prefer-dist(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/QCItwh /usr/bin/composer install --no-interaction git com-sebastianbergit(http block)https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/HRFIQg /usr/bin/composer install(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/vVFooF /usr/bin/composer install --no-interaction --prefer-dist(http block)/usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/QCItwh /usr/bin/composer install --no-interaction git com-sebastianbergit(http block)https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3cREDACTED, pid is -1(http block)If you need me to access, download, or install something from one of these locations, you can either: