sqflite_migration icon indicating copy to clipboard operation
sqflite_migration copied to clipboard

Migrations with "--" in text strings fail

Open gscottschulz opened this issue 4 years ago • 0 comments

Hi @FilledStacks, First off, I love all your content! But my query below is failing when using this plugin because it has a string that contains "--". I think https://github.com/FilledStacks/sqflite_migration/blob/396b9a762054157b00cd5bc6b01739ab17428b15/lib/src/database_migration_service.dart#L29-L40 is the problem because it doesn't take situations where "--" might be valid. For example,

CREATE TABLE Assets (
   id             INTEGER   NOT NULL  PRIMARY KEY
  ,filePath       TEXT      NOT NULL
  ,nameSingular   TEXT      NOT NULL
  ,namePlural     TEXT      NOT NULL
  ,sourceUrl      TEXT      NOT NULL
  ,active         INTEGER   NOT NULL  DEFAULT 1
);

INSERT INTO Assets (
   id
  ,filePath
  ,nameSingular
  ,namePlural
  ,sourceUrl
  ,active
) VALUES (
   1
  ,'assets/svg/openclipart.com/francesco_rollandin/Architetto----Dino-08.svg' -- notice the '----' in the path
  ,'Dinosaur'
  ,'Dinosaurs'
  ,'https://openclipart.org/detail/25749/architetto-dino-08'
  ,1
);

This isn't a total deal-breaker in my case because I can just change the filename, but others may run into this issue and be like, AAAAAAAAAHHHHHH!!!!!!

Thanks to everyone at FilledStacks!

gscottschulz avatar Apr 30 '21 21:04 gscottschulz