src/db/databaseconnection.cpp
QString DatabaseConnection::extractMigrateUpContent(const QString &allContent) noexcept {
  auto copying = false;
  QString upContent;
  for (const QString &line : allContent.split("\n")) {
    if (line.trimmed().toLower() == "-- +migrate up") {
      copying = true;
    }
    else if (line.trimmed().toLower() == "-- +migrate down") {
      if (copying) {
        break;
      }
      copying = false;
    }
    else if (copying) {
      upContent.append(line + "\n");
    }
  }
  return upContent;
}
// extractMigrateUpContent parses the given migration content and retrieves only
// the portion that applies to the "up" / apply logic. The "down" section is ignored.
extractMigrateUpContent parses the given migration content and retrieves only
the portion that applies to the "up" / apply logic. The "down" section is ignored.
extractMigrateUpContent parses the given migration content and retrieves only the portion that applies to the " up " / apply logic . The " down " section is ignored .
QString DatabaseConnection::extractMigrateUpContent(const QString &allContent) noexcept {
  auto copying = false;
  QString upContent;
  for (const QString &line : allContent.split("\n")) {
    if (line.trimmed().toLower() == "-- +migrate up") {
      copying = true;
    }
    else if (line.trimmed().toLower() == "-- +migrate down") {
      if (copying) {
        break;
      }
      copying = false;
    }
    else if (copying) {
      upContent.append(line + "\n");
    }
  }
  return upContent;
}
QString DatabaseConnection :: extractMigrateUpContent ( const QString & allContent ) noexcept { auto copying = false ; QString upContent ; for ( const QString & line : allContent . split ( " \n " ) ) { if ( line . trimmed ( ) . toLower ( ) == " " ) { copying = true ; } else if ( line . trimmed ( ) . toLower ( ) == " " ) { if ( copying ) { break ; } copying = false ; } else if ( copying ) { upContent . append ( line + " \n " ) ; } } return upContent ; }
extractMigrateUpContent parses the given migration content and retrieves only
the portion that applies to the "up" / apply logic.
extractMigrateUpContent parses the given migration content and retrieves only the portion that applies to the " up " / apply logic .