Giter Site home page Giter Site logo

Comments (7)

greggersh avatar greggersh commented on June 9, 2024

It's very well established that db:schema:load is the way to go and that you should check in your schema.rb file. Right now, db:migrate breaks for me because a model that was used in a migration has been removed, which is completely legitimate, as opposed to not checking in your schema, which is just sloppy. I say support and encourage the correct behavior, rather than account for deviations from the accepted standard. But whatever works.

from cruisecontrol.rb.

thewoolleyman avatar thewoolleyman commented on June 9, 2024

reposting prior recomment as myself ;)

"db:schema:load will break if you don't check in schema.rb (which not everyone does). Maybe db:schema:load, with a fallback to migrate if schema.rb doesn't exist?"

from cruisecontrol.rb.

thewoolleyman avatar thewoolleyman commented on June 9, 2024

I would say that it is just sloppy to use your app's ActiveRecord Model classes in your migrations, which may go away, as you pointed out. If you must use an ActiveRecord model, declare a new minimal one in-line in the migration, so that the migration will never break even if you delete the table's corresponding model class from your app.

But I digress. I think the point is we should support both approaches...

from cruisecontrol.rb.

greggersh avatar greggersh commented on June 9, 2024

Touche. ;)

from cruisecontrol.rb.

tamaloa avatar tamaloa commented on June 9, 2024

+1 on db:schema:load

from cruisecontrol.rb.

bguthrie avatar bguthrie commented on June 9, 2024

The right thing to do if you need to use an ActiveRecord::Base model in your migrations is to re-declare it locally. If the code is checked in and part of your app then it should run; if it doesn't run, it should be fixed or compressed and removed. This is technical debt. If your migrations don't run anymore, then what are they still doing in your db/migrate folder?

I don't want to switch it over unilaterally since that will affect a lot of other people's builds. If anyone would like to submit a patch to make migrate/schema:load configurable I think that would be nice. If not, I'll place it in the backlog as a feature.

from cruisecontrol.rb.

bguthrie avatar bguthrie commented on June 9, 2024

The idea of trying to do the right thing based on the presence of schema.rb sounds good to me, but if you've been using db:migrate and don't check it in then won't you already have (an incorrect) one locally?

from cruisecontrol.rb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.