Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion models/IMigrationManager.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ interface {
*
* @invocationPath the component invocation path for the seed
*/
public void function runSeed( required string invocationPath, function postProcessHook, function preProcessHook );
public void function runSeed(
required string invocationPath,
function postProcessHook,
function preProcessHook,
boolean pretend
);

}
10 changes: 8 additions & 2 deletions models/MigrationService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ component accessors="true" {
public MigrationService function seed(
string seedName,
function postProcessHook = variables.noop,
function preProcessHook = variables.noop
function preProcessHook = variables.noop,
boolean pretend = false
) {
if (
!isNull( variables.environment ) && !arrayContainsNoCase(
Expand All @@ -175,7 +176,12 @@ component accessors="true" {
if ( !directoryExists( expandPath( variables.seedsDirectory ) ) ) return this;

findSeeds( argumentCollection = arguments ).each( function( file ) {
variables.manager.runSeed( file.componentPath, postProcessHook, preProcessHook );
variables.manager.runSeed(
file.componentPath,
postProcessHook,
preProcessHook,
pretend
);
} );

return this;
Expand Down
9 changes: 7 additions & 2 deletions models/QBMigrationManager.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ component accessors="true" {
public void function runSeed(
required string invocationPath,
function postProcessHook = variables.noop,
function preProcessHook = variables.noop
function preProcessHook = variables.noop,
boolean pretend = false
) {
arguments.preProcessHook( invocationPath );
var seeder = wirebox.getInstance( arguments.invocationPath );
Expand All @@ -188,10 +189,14 @@ component accessors="true" {
.setGrammar( wirebox.getInstance( defaultGrammar ) )
.setDefaultOptions( { datasource: getDatasource() } );

if ( arguments.pretend ) {
query.pretend();
}

$transactioned( function() {
invoke( seeder, "run", [ query, variables.mockData ] );
} );
arguments.postProcessHook( invocationPath );
arguments.postProcessHook( invocationPath, query );
}


Expand Down
Loading