Removing column default with a migration

Hi guys,

I'm having problems removing the default from a boolean field. I'm using the
following statement:

  change_column :valuations, :too_many_adults, :integer, :null => true

but it's adding DEFAULT '0' to the SQL statement. I'm having no luck using
change_column_default either. Is this possible?

Gareth

From the API-Reference:

If you want to set the default value to NULL, you are out of luck. You need to DatabaseStatements#execute the apppropriate SQL statement yourself.

The SQL statement would then look like the following

ALTER TABLE 'valuations' ALTER 'too_many_adults' DROP DEFAULT;

Christoph

Gareth Adams wrote: