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

  • Home
  • SEARCH
  • 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 177981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:09:04+00:00 2026-05-11T14:09:04+00:00

Migrations are undoubtedly better than just firing up phpMyAdmin and changing the schema willy-nilly

  • 0

Migrations are undoubtedly better than just firing up phpMyAdmin and changing the schema willy-nilly (as I did during my php days), but after using them for awhile, I think they’re fatally flawed.

Version control is a solved problem. The main function of migrations is to keep a history of changes to your database. But storing a different file for each change is a clumsy way to track them. You don’t create a new version of post.rb (or a file representing the delta) when you want to add a new virtual attribute — why should you create a new migration when you want to add a new non-virtual attribute?

Put another way, just as you check post.rb into version control, why not check schema.rb into version control and make the changes to the file directly?

This is functionally the same as keeping a file for each delta, but it’s much easier to work with. My mental model is ‘I want table X to have such and such columns (or really, I want model X to have such and such properties)’ — why should you have to infer from this how to get there from the existing schema; just open up schema.rb and give table X the right columns!

But even the idea that classes wrap tables is an implementation detail! Why can’t I just open up post.rb and say:

 Class Post     t.string :title     t.text :body  end 

If you went with a model like this, you’d have to make a decision about what to do with existing data. But even then, migrations are overkill — when you migrate data, you’re going to lose fidelity when you use a migration’s down method.

Anyway, my question is, even if you can’t think of a better way, aren’t migrations kind of gross?

  • 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. 2026-05-11T14:09:04+00:00Added an answer on May 11, 2026 at 2:09 pm

    why not check schema.rb into version control and make the changes to the file directly?

    Because the database itself is not in sync with version control.

    For instance, you could be using the head of the source tree. But you’re connecting to a database that was defined as some past version, not the version you have checked out. The migrations allow you to upgrade or downgrade the database schema from any version and to any version, incrementally.

    But to answer your last question, yes, migrations are kind of gross. They implement a redundant revision control system on top of another revision control system. However, neither of these revision control systems is really in sync with the database.

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

Sidebar

Related Questions

In Rails Migrations, what does the number specified for the :limit parameter on an
I have a sequence of migrations in a rails app which includes the following
Rails uses the concept of migrations to deal with model changes using the ActiveRecord
I'm creating a bunch of migrations, some of which are standard create table or
Suppose you are implementing a publication database and creating migrations to represent different publications.
Ok thanks for the 1st guy I found the code. Machine.Migrations: I mean, the
I use both ruby on rails and Java. I really enjoy using migrations when
I have a migration that runs an SQL script to create a new Postgres
We are migrationg from CVS to SVN and embracing some kind of revision management
I have a migration in Rails that inserts a record into the database. The

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.