Monday, December 21, 2009

change_column at rails

I want to change the column length of "name" column to 200 chars at FOLDER table because I got too short column SQL error.


You need to create a ChangeLengthOfNameColumnOfFolder with the following:

rake db:migrate change_length_of_name_column_of_folder


Then, update the up and down functions as follows:

class ChangeLengthOfNameColumnOfFolder < ActiveRecord::Migration
def self.up
add_column :folder, :name_sixty, :string, :limit => 200, :null => false
NaicsCategory.reset_column_information
remove_column :folder, :name
rename_column :folder, :name_sixty, :name
change_column :folder, :name, :string, :limit => 200, :null => false
end

def self.down
drop_table :folder
end
end

Then,
rake db:migrate

Introduction to Cloud Computing

  • Jongwook Woo, California State University, Los Angeles,
    Introduction to Cloud Computing
    , the 10th KOCSEA 2009 Symposium, UNLV,
    Dec 18-19, 2009
  • Tuesday, November 10, 2009

    Sphinx Dynamic index

    Once your Sphinx search engine is connected to your datasource, when the datasource is updated, the search engine also need to be searchable for the updated data.

    Thus, the engine should be dynamically reindexed with the following command at the terminal (or DOS command prompt)

    indexer -c %your_rails_project%/config/sphinx.conf --rotate --all

    or

    indexer --config %your_rails_project%/config/sphinx.conf --rotate --all