 		local.rv = local.rv & "#Chr(13)#------- " & local.migration.cfcfile & " #RepeatString("-", Max(5, 50-Len(local.migration.cfcfile)))##Chr(13)#";
 		request.$wheelsMigrationOutput = "";
 		request.$wheelsMigrationSQLFile = "#this.paths.sql#/#local.migration.cfcfile#_redo.sql";
-		if (local.settings.writeMigratorSQLFiles) {
+		if (application[local.appKey].writeMigratorSQLFiles) {
 			FileWrite(request.$wheelsMigrationSQLFile, "");
 		}
-		if (local.settings.allowMigrationDown) {
+		if (application[local.appKey].allowMigrationDown) {
 			local.migration.cfc.down();
 		}
 		local.migration.cfc.up();

 * Inserts a record to flag a version as migrated.
 */
private void function $setVersionAsMigrated(required string version) {
	local.settings = $getMigratorSettingsScope();
	$query(
		datasource=local.settings.dataSourceName,
		sql="INSERT INTO #local.settings.migratorTableName# (version) VALUES ('#$sanitiseVersion(arguments.version)#')"
	);
}


public string function migrateTo(string version="") {
	local.rv = "";
	local.currentVersion = getCurrentMigrationVersion();
	local.appKey = $appKey();
	if (local.currentVersion == arguments.version) {
		local.rv = "Database is currently at version #arguments.version#. No migration required.#chr(13)#";
	} else {
		if (!DirectoryExists(this.paths.sql) && application[local.appKey].writeMigratorSQLFiles) {
			DirectoryCreate(this.paths.sql);
		}
		local.migrations = getAvailableMigrations();
