Skip to content

Commit

Permalink
renameConstraint can take TableIndex instances as well as strings to …
Browse files Browse the repository at this point in the history
…rename a constraint
  • Loading branch information
elpete committed Sep 30, 2017
1 parent 3fd4c39 commit 4e9476d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions models/Schema/Blueprint.cfc
Expand Up @@ -307,13 +307,13 @@ component accessors="true" {
return this;
}

function modifyColumn( name, newColumnDefinition ) {
addCommand( "modifyColumn", { from = name, to = newColumnDefinition } );
function modifyColumn( name, column ) {
addCommand( "modifyColumn", { from = name, to = column } );
return this;
}

function renameColumn( name, newColumnDefinition ) {
addCommand( "renameColumn", { from = name, to = newColumnDefinition } );
function renameColumn( name, column ) {
addCommand( "renameColumn", { from = name, to = column } );
return this;
}

Expand All @@ -333,7 +333,13 @@ component accessors="true" {
}

function renameConstraint( oldName, newName ) {
addCommand( "renameConstraint", { from = oldName, to = newName } );
if ( ! isSimpleValue( arguments.oldName ) ) {
arguments.oldName = dropConstraint( arguments.oldName.getName() );
}
if ( ! isSimpleValue( arguments.newName ) ) {
arguments.newName = dropConstraint( arguments.newName.getName() );
}
addCommand( "renameConstraint", { from = arguments.oldName, to = arguments.newName } );
return this;
}

Expand Down

0 comments on commit 4e9476d

Please sign in to comment.