I've just finished extracting and saving all the info from my database
and I need to copy the contents from "description" field to the newly
created fields "meta_description" and "meta_keywords" How do you do
this? I don't want my existing data to get messed up. Any help would be
appreciated. Thanks.
I've successfully added the new meta description and keywords using
migrations
<code><pre>
$ ./script/generate migration
remove_description_and_keyword_from_content description:text
keyword:text
exists db/migrate
create
db/migrate/003_remove_description_and_keyword_from_content.rb
</pre></code>
*and here's my database schema*
<pre><code>
ActiveRecord::Schema.define(:version => 2) do
create_table "contents", :force => true do |t|
t.string "title"
t.string "description" #<--- How do you copy all data from this
field
t.text "detail"
t.string "image"
t.string "product"
t.string "link"
t.float "price"
t.string "other"
t.string "target"
t.float "cost"
t.string "shipping"
t.datetime "created_at"
t.datetime "updated_at"
t.text "meta_description" #<--- to here and
t.text "meta_keyword" #<--- Here
end
I'm sorry forgot that it's a mysql statement, I tried it on mysql but
gave me this error
UPDATE table contents SET meta_description = description,
meta_keyword = description;
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'table contents SET meta_description = description,
meta_keyword = description' at line 1
> UPDATE table contents SET meta_description = description,
meta_keyword = description;
ERROR 1064 (42000): You have an error in your SQL syntax; check the