18 bool MatchesSchema (
const QString& baseName,
const QString& schema, QSqlDatabase& db)
21 "SELECT sql FROM sqlite_master WHERE type = 'table' AND name = '%1'"_qs
26 const auto& existingDDL = result.value (0).toString ();
28 auto figureOutFields = [] (
const QString& str)
30 auto firstOpen = str.indexOf (
'(');
31 auto lastClose = str.lastIndexOf (
')');
32 return str.midRef (firstOpen, lastClose - firstOpen);
34 auto existing = figureOutFields (existingDDL);
35 auto suggested = figureOutFields (schema);
36 return existing == suggested;