Skip to content

Commit 73de69f

Browse files
authored
fix(QBMigrationManager): Set datasource on qb instance when running seeds
1 parent 6b35c56 commit 73de69f

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

models/IMigrationManager.cfc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ interface {
5959
*
6060
* @invocationPath the component invocation path for the seed
6161
*/
62-
public void function runSeed(
63-
required string invocationPath,
64-
function postProcessHook,
65-
function preProcessHook
66-
);
62+
public void function runSeed( required string invocationPath, function postProcessHook, function preProcessHook );
6763

6864
}

models/MigrationService.cfc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,7 @@ component accessors="true" {
175175
if ( !directoryExists( expandPath( variables.seedsDirectory ) ) ) return this;
176176

177177
findSeeds( argumentCollection = arguments ).each( function( file ) {
178-
variables.manager.runSeed(
179-
file.componentPath,
180-
postProcessHook,
181-
preProcessHook
182-
);
178+
variables.manager.runSeed( file.componentPath, postProcessHook, preProcessHook );
183179
} );
184180

185181
return this;

models/QBMigrationManager.cfc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,12 @@ component accessors="true" {
178178
) {
179179
arguments.preProcessHook( invocationPath );
180180
var seeder = wirebox.getInstance( arguments.invocationPath );
181-
var query = wirebox.getInstance( "QueryBuilder@qb" ).setGrammar( wirebox.getInstance( defaultGrammar ) );
181+
182+
var query = wirebox
183+
.getInstance( "QueryBuilder@qb" )
184+
.setGrammar( wirebox.getInstance( defaultGrammar ) )
185+
.setDefaultOptions( { datasource: getDatasource() } );
186+
182187
$transactioned( function() {
183188
invoke( seeder, "run", [ query, variables.mockData ] );
184189
} );

0 commit comments

Comments
 (0)