I need to change the column type from time to datetime in rails.I cant't change the column type.It show this error
"rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::DatatypeMismatch: ERROR: column "fun_from" cannot be cast automatically to type timestamp without time zone
HINT: Specify a USING expression to perform the conversion.
: ALTER TABLE "general_infos" ALTER COLUMN "fun_from" TYPE timestamp/home/PCA/db/migrate/20150730102811_change_data_type_in_general_infos.rb:3:in `change'
ActiveRecord::StatementInvalid: PG::DatatypeMismatch: ERROR: column "fun_from" cannot be cast automatically to type timestamp without time zone
HINT: Specify a USING expression to perform the conversion.
: ALTER TABLE "general_infos" ALTER COLUMN "fun_from" TYPE timestamp
/home/PCA/db/migrate/20150730102811_change_data_type_in_general_infos.rb:3:in `change'
PG::DatatypeMismatch: ERROR: column "fun_from" cannot be cast automatically to type timestamp without time zone
HINT: Specify a USING expression to perform the conversion.
/home/PCA/db/migrate/20150730102811_change_data_type_in_general_infos.rb:3:in `change'"
Below format i tried,
change_column(:table_name, :column_name, :datetime )
and also tried below format
change_column :table_name, :column_name, 'datetime USING CAST(column_name AS datetime)'
psql version - 9.4.4 & Any one give me solution.