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 7439919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:46:30+00:00 2026-05-29T10:46:30+00:00

So assume I have used rails generate to create a model and subsequently it

  • 0

So assume I have used rails generate to create a model and subsequently it created migrations for it.

Now it turns out I made a couple of modifications to those models (fixed up some relations). Is it possible to create migrations based off of my current model?

  • I don’t want to use rails generate to generate the model again.
  • I don’t want to manually write a migration.
  • 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-05-29T10:46:31+00:00Added an answer on May 29, 2026 at 10:46 am

    What do you need to do with that migration?

    If you need to remove or add some columns, you could use:
    AddXXXToYYY and
    RemoveXXXFromYYY.

    So if you want to add a certain column to YYY table use:

    rails generate migration add_attr1_and_attr2_to dogs attr1:string attr2:string

    This would generate (rails 3.2.0):

    class AddAttr1AndAttr2ToDogs < ActiveRecord::Migration
      def change
        add_column :dogs, :attr1, :string
    
        add_column :dogs, :attr2, :string
    
      end
    end
    

    Same goes for removing the columns:

    r g migration remove_attr1_and_attr2_from_dogs attr1:string attr2:string

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

Sidebar

Related Questions

I have used git update-index --assume-unchanged on some files to keep my changes to
Here is the senario. I have a model called Permission. Lets assume it looks
Assume I have a C# class like this: [XmlRoot(floors)] public class FloorCollection { [XmlElement(floor)]
Assume I have the following string: Hellotoevryone<img height=115 width=150 alt= src=/Content/Edt/image/b4976875-8dfb-444c-8b32-cc b47b2d81e0.jpg />Iamsogladtoseeall. This
Assume I have access to a SMB server at IP 1.2.3.4, how can I
Assume I have a application that stores data,gets data and processes data and stores
Assume you have a file which has been committed in your Git repo. You
Assume I have 2 time intervals,such as 16:30 - 20:00 AND 15:00 - 19:00,
Assume I have this domain object... public class SpansMultipleTables { public int CommonID {get;
Assume we have a single Windows form with a button called SimpleButton1. The following

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.