PageRenderTime 21ms CodeModel.GetById 17ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/plugins/dbmigrate/templates/create-index.cfc

http://raihan.googlecode.com/
ColdFusion CFScript | 25 lines | 24 code | 1 blank | 0 comment | 2 complexity | 58f5a964888b49e69d267583dbfc1a96 MD5 | raw file
 1<!---
 2    |----------------------------------------------------------------------------------------------------------------------------|
 3	| Parameter     | Required | Type    | Default | Description                                                                 |
 4    |----------------------------------------------------------------------------------------------------------------------------|
 5	| table         | Yes      | string  |         | table name                                                                  |
 6	| columnNames   | Yes      | string  |         | one or more column names to index, comma separated                          |
 7	| unique        | No       | boolean |  false  | if true will create a unique index constraint                               |
 8	| indexName     | No       | string  |         | use for index name. Defaults to table name + underscore + first column name |
 9    |----------------------------------------------------------------------------------------------------------------------------|
10
11    EXAMPLE:
12      addIndex(table='members',columnNames='username',unique=true);
13--->
14<cfcomponent extends="[extends]" hint="[description]">
15  <cffunction name="up">
16    <cfscript>
17		addIndex(table='tableName',columnNames='columnName',unique=true);
18    </cfscript>
19  </cffunction>
20  <cffunction name="down">
21    <cfscript>
22	    removeIndex(table='tableName', indexName='');
23    </cfscript>
24  </cffunction>
25</cfcomponent>