Skip to content

apimigrationexecute

Troy Murray edited this page Sep 19, 2011 · 3 revisions

execute()

Usage

Executes a raw sql query, generally used for database specific features.

Function Syntax

execute(sql);

Parameters

Parameter Type Required Default Description
sql string Yes SQL statement to execute

Example

<cfcomponent extends="plugins.dbmigrate.Migration" hint="add composite primary key to tagging table">
  <cffunction name="up">
    <cfscript>
      execute('ALTER TABLE mydb.taggings ADD PRIMARY KEY (tagid,callid);');
    </cfscript>
  </cffunction>
  <cffunction name="down">
    <cfscript>
      execute('ALTER TABLE mydb.taggings DROP PRIMARY KEY');
    </cfscript>
  </cffunction>
</cfcomponent>

Clone this wiki locally