Schema rb not updating
However, during very early stages of development, I often edit the existing migration files instead of creating new ones.
This is useful when I’m still figuring out the schema, and often need to add fields to existing models.
The only problem with this is the fact that Heroku doesn't like migrations in this format.
This is what you should be using for the vast majority of cases.
As my capstone project for Metis, I created Bdwy Critic (source on Git Hub), a review aggregator for Broadway shows, similar to Metacritic.
Every show (I called them “events”) has many user reviews and many media (or critic) reviews.
Instead, the preferred way to deploy the database is to just load the schema itself.
Given what I know about this project and the production environment, that’s a trade-off I’m currently comfortable making.) Like any other database change in Rails, creating the view involves a migration.Because the Active Record DSL doesn’t provide methods for creating views, we actually have to write the SQL ourselves, but it’s not too complicated.The CREATE VIEW review_statistics_summary AS SELECT as event_id, AVG(user_reviews.score) AS average_user_review, AVG(media_reviews.score) AS average_media_review FROM events LEFT JOIN user_reviews ON = user_reviews.event_id LEFT JOIN media_reviews ON = media_reviews.event_id GROUP BY object, we don’t even need to specify the primary key.If you want to reproduce this very same database out of a Rails environment, you just have to to the heavy work yourself, recreating the tables.Without Rails framework you just don't have a way to generate all tables just based in db/
Once you’ve got the app in production, you should definitely not be editing migration files.