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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:26:11+00:00 2026-05-20T01:26:11+00:00

Scenario: we already have a Document model, and we want to add public private

  • 0

Scenario: we already have a Document model, and we want to add

  • public
  • private

or more columns using a single migration.

From what I’ve searched and read so far, you just have to edit the migration file. If the migration was already applied, roll back and migrate again.

  1. Is this the common best practice, or is there a better way?
  2. If this is the way to do it, what would a proper naming for that migration be?
  • 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-20T01:26:11+00:00Added an answer on May 20, 2026 at 1:26 am

    Rolling back a migration and re-editing it is only safe if that migration is local and has not been pushed out to any repository. Editing a migration that others have applied may cause issues.

    The safest way to add columns to an existing table is to just create a new migration:

    rails g migration add_public_and_private_to_document public:string private:string
    

    If you use the add_[column_names]_to_[model] naming convention, rails will work out the appropriate table and create the migration you want.

    Have a read here for more info: http://guides.rubyonrails.org/migrations.html

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

Sidebar

Related Questions

We have been using ddeexec registry entries to handle opening a design from Explorer.
I have a webpage that I want to mess with using Greasemonkey. There are
I have a scenario for which I am searching a solution. I already have
Scenario Having already read a post on this on the same site, which didn't
Scenario : I'll try to put an analogy with the loan broker example from
Scenario first :- I'm using Entity Framework to do some queries, to build my
Scenario While using the Maven Ant Task artifact:deploy , I'm encountering the error java.lang.OutOfMemoryError:
Scenario: Every page on the website will have a menu bar at the top
Scenario 1: If I have a Great Grandpa ancestor (let's name him A); And
Let's consider the following scenario. I have the following page where all rendered elements

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.