recentpopularlog in

colin.jack : migrations   7

Bye Bye Mongo, Hello Postgres | Hacker News
excellent write up of a migration from mongodb to postgres.
guardian  mongodb  PostgreSQL  Migrations 
7 weeks ago by colin.jack
How to use Rails migrations and schema - Ian's Tech Notes
"So while migrations are the right tool for existing environments, they’re not a good option for new environments. Thankfully, the Rails community has settled on a better solution: check in your schema.rb. When a new developer wants their own database, they simply load the structure specified in your schema by running rake db:setup (or rake db:schema:load). No messy chain of migrations, just a direct creation of the newest database tables. This method is faster, cleaner, and avoids all the ugly failures that can crop up in an extensive migration chain.

What seems like two different solutions is actually two parts of the same solution. The schema file represents the current state of the database. The migrations explain how to reach that state from somewhere else. I like to check in a new migration and the changes it causes to schema.rb in the same commit."
Migrations  RelationalDB 
january 2016 by colin.jack
Active Record Migrations — Ruby on Rails Guides
"Migrations, mighty as they may be, are not the authoritative source for your database schema. That role falls to either db/schema.rb or an SQL file which Active Record generates by examining the database. They are not designed to be edited, they just represent the current state of the database.

There is no need (and it is error prone) to deploy a new instance of an app by replaying the entire migration history. It is much simpler and faster to just load into the database a description of the current schema.

For example, this is how the test database is created: the current development database is dumped (either to db/schema.rb or db/structure.sql) and then loaded into the test database.

Schema files are also useful if you want a quick look at what attributes an Active Record object has. This information is not in the model's code and is frequently spread across several migrations, but the information is nicely summed up in the schema file. The annotate_models gem automatically adds and updates comments at the top of each model summarizing the schema if you desire that functionality."
RelationalDB  Migrations 
january 2016 by colin.jack
InfoQ: Ruby on Rails 3.1 Released, Brings Assets Pipeline, Streaming, and Javascript Changes
"Basically if you define a change method [instead of up and down methods as before] in your migration and are applying the migration then the commands are executed as normal. However while reversing the migration, the commands are recorded and a list of inverse commands is generated and run. Inverse commands are simply commands that perform the opposite of the original command. "
Rails3.1  Migrations  Rails 
september 2011 by colin.jack

Copy this bookmark:

to read