Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9268287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:46:20+00:00 2026-06-18T14:46:20+00:00

I have update migrate script under db/migrate, and I did a rake db:migrate database

  • 0

I have update migrate script under db/migrate, and I did a

rake db:migrate

database script before update

class CreateStudents < ActiveRecord::Migration
  def change
    create_table :students do |t|
      t.string :firstname
      t.string :lastname      
      t.string :account
      t.timestamps
    end
  end
end 

databse script after update

class CreateStudents < ActiveRecord::Migration
  def change
    create_table :students do |t|
      t.string :firstname
      t.string :lastname      
      t.string :account
      t.string :address      
      t.string :city
      t.string :state
      t.string :postcode                        
      t.string :homephone
      t.timestamps
    end
  end
end 

after I dropped the old development.sqlite3 and old schema in schame.rb.
Say I added a few columns, but in the model these columns is missing.

But my model still is

class Student < ActiveRecord::Base
  attr_accessible :firstname,:lastname,:account,
end

Is there a easy way I can bring the changes in new migrate script to model ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:46:22+00:00Added an answer on June 18, 2026 at 2:46 pm

    It looks like maybe you did rails generate migration which isn’t meant to affect your model. I believe after you create your model everything afterward has to be done manually.

    If you really want to effect changes to your database and model at the same time, your best bet might be to delete your migrations and model and do a rails generate scaffold (documentation) to create your entire scaffolding from scratch.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example I have the following migration class AddStatusField < ActiveRecord::Migration def self.up add_column
I'm making Liquibase migration using groovy script. I have a code like def migrate()
Steps to produce this: prompt>rails test_app prompt>cd test_app prompt>script/generate scaffold date_test my_date:datetime prompt>rake db:migrate
I have a question to the following procedure: script/generate scaffold product title:string description:text db:migrate
I have been trying to migrate a SQL Server 2005 database to MySQL 5.5.29
The Background We have a rails migration script as below: ... ... 0011_update_column1_for_internal_projects.rb ...
For example i have this model: class Product < ActiveRecord::Base attr_accessible :name, :order end
I have a rake task intended to migrate legacy db fields into a Hash
I have been using the Grails database-migration plugin during development of my application, and
I have to migrate data from one database to another. As preparation we have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.