Skip to content

Instantly share code, notes, and snippets.

@joeydaly
Created June 6, 2014 06:08
Show Gist options
  • Save joeydaly/d1959884bc28d7138ed2 to your computer and use it in GitHub Desktop.
Save joeydaly/d1959884bc28d7138ed2 to your computer and use it in GitHub Desktop.
DBMigrate - references not working bug
<cfcomponent extends="joey.cfwheels.plugins.dbmigrate.Migration" hint="create player table">
<cffunction name="up">
<cfscript>
t = createTable(name='players');
t.string(columnNames='first_name', default='', null=true, limit='255');
t.string(columnNames='last_name', default='', null=true, limit='255');
t.timestamps();
t.create();
</cfscript>
</cffunction>
<cffunction name="down">
<cfscript>
dropTable('players');
</cfscript>
</cffunction>
</cfcomponent>
<cfcomponent extends="joey.cfwheels.plugins.dbmigrate.Migration" hint="create club table">
<cffunction name="up">
<cfscript>
t = createTable(name='clubs');
t.string(columnNames='name', default='', null=true, limit='255');
t.timestamps();
t.create();
</cfscript>
</cffunction>
<cffunction name="down">
<cfscript>
dropTable('clubs');
</cfscript>
</cffunction>
</cfcomponent>
<cfcomponent extends="joey.cfwheels.plugins.dbmigrate.Migration" hint="add club reference on player table">
<cffunction name="up">
<cfscript>
t = changeTable('players');
t.references('club');
t.change();
</cfscript>
</cffunction>
<cffunction name="down">
<cfscript>
dropReference('players','club');
</cfscript>
</cffunction>
</cfcomponent>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment