1

created a new rails db migration for renaming a set of columns including one with blob format. when running the migration the following error occurs and the migration is canceled:

SQLite3::SQLException: unrecognized token: "'Salted__��v�/JB���*}�]��+Ai��x��w=9yǚ�...

the migration:

...
rename_column :users, :private_key, :encrypted_private_key
...

as far as I know when a column is renamed, there is a temporary table created. to me it looks like there's a problem when creating this temporary table.

is there any way to rename a blob column ?

Rails 4.2.0, Activerecord 4.2.0

user1727870
  • 121
  • 7
  • Instead of AR handling the migration.. in your migration file put this in your up method: execute "alter table users change private_key encrypted_private_key varchar(255)" – ilan berci Nov 02 '15 at 16:28

1 Answers1

0

Check this link explained well

Renaming column

In case, if you need change format of table:

rails g migration ChangeFormatInTablenameColumnname

class ChangeFormatInUsersAdmin < ActiveRecord::Migration
  def change
    change_column :users(tablename), :admin(columnname), :boolean(type), default: false
  end
end
Community
  • 1
  • 1
7urkm3n
  • 6,054
  • 4
  • 29
  • 46
  • thx for the link but it doesn't explain how to handle blob fields. As described in my post it's clear to me how to write a migration for renaming a column. – user1727870 Nov 09 '15 at 06:42