Return to v2.2 docs

down()


Migrator Migration Functions void migration


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

function down() {
	transaction {
		try {
			// your code goes here
			dropTable('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