Topic: Problem with adding columsn to tables in sqlite3

I'm getting this error while trying to add a column to my users table in sqlite3.

SQLite3::SQLException: near "ADD": syntax error: ALTER TABLE users ADD "biography" varchar(255)


I'm also using 3.2.8 (just upgraded today) someone told me my previous version didn't support this. But now with the upgrade it still doesn't? What's going on.

Please help,
Thanks.

http://danielfischer.com - Personal Web-Technology-Blog, Los Angeles.

Re: Problem with adding columsn to tables in sqlite3

Maybe you could try ADD COLUMN:
ALTER TABLE users ADD COLUMN "biography" varchar(255)

In the documation it's marked as optional:
http://www.sqlite.org/lang_altertable.html

But I think it's worth to try.

My homepage: http://www.komendera.com/
Working at: http://www.abloom.at/
My blog: soaked and soaped http://soakedandsoaped.com/

Re: Problem with adding columsn to tables in sqlite3

Meh, if it doesn't work via migration it's not worth my time. I already ditched sqlite and went back to MySql now.

Last edited by DFischer (2007-01-29 16:52:54)

http://danielfischer.com - Personal Web-Technology-Blog, Los Angeles.

Re: Problem with adding columsn to tables in sqlite3

$ sqlite3
SQLite version 3.3.5


For me it works - also with migrations.

My homepage: http://www.komendera.com/
Working at: http://www.abloom.at/
My blog: soaked and soaped http://soakedandsoaped.com/

Re: Problem with adding columsn to tables in sqlite3

I am having the same problem, when I run a migration (rake db:migrate), I get the error:

SQLite3::SQLException: near "ADD": syntax error: ALTER TABLE stories ADD "permalink" varchar(255)

So I created a quick table in SQLite3 (from the Terminal CLI), and copied the above sql statement and it executes just fine. So why would it not work in rails, but does in the SLQite3 interface?

I would like to figure this out. Anyone willing to help?

TIA

Re: Problem with adding columsn to tables in sqlite3

Hi threadhead,

I have the same problem. The problem is resolved by reinstalling the gem:

$ sqlite3 -version
3.3.16

$ sudo gem uninstall -a sqlite3-ruby
$ sudo gem install -y sqlite3-ruby

Good Luck
siuying

Last edited by siuying (2007-05-26 13:01:07)

Re: Problem with adding columsn to tables in sqlite3

@liuying:
You are right, but it is a two parter (which I figured out after a lot of searching:
1) Upgrade to the latest version of SQLite3.
2) Uninstall/re-Install the SQLite3-ruby gem.

Thanks!
Karl