Search code examples
mysqlormcoldfusioncoldfusion-9

ColdFusion 9 ORM: Default value does not work for strings


I'm trying to create a new string property with a default value:

<cfproperty fieldtype="column" name="showIn" ormtype="string" default="credentials" notnull="true" required="false" />

After a ORMReload() the column is present in the database, but without a default value.


I expect:

showIn VARCHAR(255) NOT NULL DEFAULT "credentials"

I get:

showIn VARCHAR(255) NOT NULL


I'm using MySQL 5.1.63 and ColdFusion 9. (Adobe)

Am I missing something here?


Solution

  • Use dbdefault instead of default:

    <cfproperty fieldtype="column" name="showIn" ormtype="string" dbdefault="credentials" notnull="true" required="false" />
    

    From the documentation:

    dbdefault: This sets the default value of a column in the table when schema is exported.