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

fix(migration): invalid behavior while using -- or /* */ inside column string #397

Merged
merged 3 commits into from
Dec 17, 2024

Conversation

farnabaz
Copy link
Collaborator

@farnabaz farnabaz commented Dec 16, 2024

Having one of the below queries

insert into table (content) values ('---\nkey: value\n---');
insert into table (content) values ('```\n/* this is comment */\n```');
insert into table (content) values ('hello; world');

breaks migration execution

So far I have found three breaking characters.

  • -- inline comment format: Removes everything after -- (assumes it is a comment)
  • /* */ multi-line comments: Removed content between
  • ; query separator: Splits to invalids queries

I added some tests to check splitter behavior, We can improve tests if some known edge cases are missing.

Copy link

cloudflare-workers-and-pages bot commented Dec 16, 2024

Deploying playground with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9012f07
Status: ✅  Deploy successful!
Preview URL: https://24873873.playground-bhb.pages.dev
Branch Preview URL: https://fix-migration-sql-spliter.playground-bhb.pages.dev

View logs

Copy link

pkg-pr-new bot commented Dec 16, 2024

Open in Stackblitz

npm i https://pkg.pr.new/nuxt-hub/core/@nuxthub/core@397

commit: 9012f07

@atinux atinux merged commit 67514e8 into main Dec 17, 2024
9 checks passed
@atinux atinux deleted the fix/migration-sql-spliter branch December 17, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants