On Jan 20, 8:31 am, Duc Qui <[email protected]> wrote:
> Using SQL Server 2008 R2
> sequel 3.31.0
>
> alter_table(:table_name) do
>   set_column_type(:column_name, :bit, {:null => false})
> end
>
> Expected
> ALTER TABLE [table_name] ALTER COLUMN [column_name] bit NOT NULL
>
> but got this instead
> ALTER TABLE [table_name] ALTER COLUMN [column_name] bit
>
> Tried both options allow_null => false and null => false.

This is not a bug.  set_column_type should only be used to change the
type, and the NULL/NOT NULL setting is a constraint on the column's
values, not part of the column's type.  You should use
set_column_allow_null afterward if you want to set the NOT NULL
constraint on the column in addition to changing its type.

There is a related bug in that not all parts of the type get used (so
String, :fixed=>true wouldn't work correctly), and it may not keep the
existing NULL/NOT NULL setting.  I'm currently testing a fix for this,
I hope to commit it later today.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to