Issue Details (XML | Word | Printable)

Key: ACTIVERECORD_JDBC-16
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: headius
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
activerecord-jdbc

sqlite3 alter table error while installing Radiant CMS

Created: 25/Apr/09 04:31 PM   Updated: 01/Oct/09 09:06 PM   Resolved: 01/Oct/09 09:06 PM
Component/s: SQLite3
Affects Version/s: 0.9.1
Fix Version/s: 0.9.2

Time Tracking:
Not Specified

Tags:


 Description  « Hide

Ran into this trying to follow Radiant setup instructions on sqlite3 here: http://radiantcms.org/download/

I'm not sure this isn't a Rails 2.3 bug, though...

== 3 RenameBehaviorColumn: migrating ==========================================
-- rename_column(:pages, :behavior, :behavior_id)
rake aborted!
ActiveRecord::ActiveRecordError: near "ALTER": syntax error: ALTER TABLE pages ALTER COLUMN behavior RENAME TO behavior_id


bbrowning added a comment - 12/Aug/09 01:43 AM - edited

SQLite3 doesn't allow you to rename columns via the ALTER TABLE statement. Instead, you have to move the existing table to a temporary table, create a new table with the new column name, and copy the data into the new table.

Tracing activerecord's sqlite rename_column method provides the details:
http://github.com/rails/rails/blob/0a558b36eb3858ceeb926ada1388b0bd41da11f7/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb#L306-311

activerecord-jdbc's sqlite adapter needs to be updated to do this instead of executing an ALTER TABLE statement.


Nick Sieger added a comment - 01/Oct/09 09:06 PM

Should be fixed in 0.9.2 as part of a bunch of sqlite fixes.