how do I change the column in a table to allow null? I have change_column :docs, :orga, :null in my migration file but I get an error: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''null DEFAULT '''' NOT NULL'' at line 1: ALTER TABLE `docs` CHANGE `orga` `orga null DEFAULT '''' NOT NULL -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Actually, I had :null=> true On Mar 23, 5:01 pm, ES <emsto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> how do I change the column in a table to allow null? > > I have > > change_column :docs, :orga, :null > > in my migration file but I get an error: > > Mysql::Error: You have an error in your SQL syntax; check the manual > that corresponds to your MySQL server version for the right syntax to > use near ''null DEFAULT '''' NOT NULL'' at line 1: ALTER TABLE `docs` > CHANGE `orga` `orga null DEFAULT '''' NOT NULL-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 March 2010 16:11, ES <emstolfo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Actually, I had :null=> true > > On Mar 23, 5:01 pm, ES <emsto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> how do I change the column in a table to allow null? >> >> I have >> >> change_column :docs, :orga, :nullIf you check the docs for change_column you will see that you need the column type even if it has not changed change_column :docs, :orga, whatever_type_it_is :null=>true Colin>> >> in my migration file but I get an error: >> >> Mysql::Error: You have an error in your SQL syntax; check the manual >> that corresponds to your MySQL server version for the right syntax to >> use near ''null DEFAULT '''' NOT NULL'' at line 1: ALTER TABLE `docs` >> CHANGE `orga` `orga null DEFAULT '''' NOT NULL > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
cool thanks On Mar 23, 5:21 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 23 March 2010 16:11, ES <emsto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Actually, I had :null=> true > > > On Mar 23, 5:01 pm, ES <emsto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> how do I change the column in a table to allow null? > > >> I have > > >> change_column :docs, :orga, :null > > If you check the docs for change_column you will see that you need the > column type even if it has not changed > change_column :docs, :orga, whatever_type_it_is :null=>true > > Colin > > > > >> in my migration file but I get an error: > > >> Mysql::Error: You have an error in your SQL syntax; check the manual > >> that corresponds to your MySQL server version for the right syntax to > >> use near ''null DEFAULT '''' NOT NULL'' at line 1: ALTER TABLE `docs` > >> CHANGE `orga` `orga null DEFAULT '''' NOT NULL > > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.