over 7 years ago
This the existing table in migration folder.
class CreateArticles < ActiveRecord::Migration
create_table :articles do |t|
t.timestamps null: false
Now I have to add column or a new field "Picture" to the table Articles.
so, i have to create migration by using this command in the terminal.
$ rails generate migration AddPictureToArticle picture:binary
Here, we are generating migration "Add" creates "change" method in Migration, and "ToArticle" indicates the table "articles."
So, I got a migration file, db/migrate/20160112054236_add_picture_to_article.rb whose contents is:
class AddPictureToArticle < ActiveRecord::Migration
add_column :articles, :picture, :binary
Now all we have to do is:
$ rake db:migrate
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Terms of Service
| © copyright 2023 FindNerd.com. All rights reserved.
Sign up using