Return to v2.1 docs


Migrator Migration Functions void migration

Migrates up: will be executed when migrating your schema forward Along with down(), these are the two main functions in any migration file Only available in a migration CFC

function up() {
	transaction {
		try {
			// your code goes here
			t = createTable(name='myTable');
		} catch (any e) {
			local.exception = e;

		if (StructKeyExists(local, "exception")) {
			transaction action="rollback";
			throw(errorCode="1", detail=local.exception.detail, message=local.exception.message, type="any");
		} else {
			transaction action="commit";

Related Functions

Migration Functions