Donald,

It won't be a minor annoyance if the migration tries to change one of my tables that has over a billion rows.

Henry

On 11/03/16 02:33 PM, Donald Ziesig wrote:
Hi All!

I just upgraded to Rails 5.0.0.beta3 and everything seemed to be going well until I noticed a minor annoyance.

I think I saw the same thing with beta2 but I was in the middle of learning coffeescript so I was not paying attention.
It is not harmful, just strange.

When I do rails generate hobo:migration, the migration itself happens correctly, but it seems to be updating all tables that have columns with default values, as well.

For example, I added one field to a "Setup" table and ran hobo:migration. The terminal output is:

Running via Spring preloader in process 13666

---------- Up Migration ----------
change_column :appointments, :completed, :boolean, :default => false
change_column :appointments, :cancelled, :boolean, :default => false

change_column :properties, :mon_start, :float, :default => 0
change_column :properties, :mon_end, :float, :default => 0
change_column :properties, :tue_start, :float, :default => 0
change_column :properties, :tue_end, :float, :default => 0
change_column :properties, :wed_start, :float, :default => 0
change_column :properties, :wed_end, :float, :default => 0
change_column :properties, :thu_start, :float, :default => 0
change_column :properties, :thu_end, :float, :default => 0
change_column :properties, :fri_start, :float, :default => 0
change_column :properties, :fri_end, :float, :default => 0
change_column :properties, :sat_start, :float, :default => 0
change_column :properties, :sat_end, :float, :default => 0
change_column :properties, :sun_start, :float, :default => 0
change_column :properties, :sun_end, :float, :default => 0

add_column :setups, :hours_in_advance, :integer #### the only change I made.

change_column :users, :is_admin, :boolean, :default => false
----------------------------------

---------- Down Migration --------
change_column :appointments, :completed, :boolean, default: false
change_column :appointments, :cancelled, :boolean, default: false

change_column :properties, :mon_start, :float, default: 0.0
change_column :properties, :mon_end, :float, default: 0.0
change_column :properties, :tue_start, :float, default: 0.0
change_column :properties, :tue_end, :float, default: 0.0
change_column :properties, :wed_start, :float, default: 0.0
change_column :properties, :wed_end, :float, default: 0.0
change_column :properties, :thu_start, :float, default: 0.0
change_column :properties, :thu_end, :float, default: 0.0
change_column :properties, :fri_start, :float, default: 0.0
change_column :properties, :fri_end, :float, default: 0.0
change_column :properties, :sat_start, :float, default: 0.0
change_column :properties, :sat_end, :float, default: 0.0
change_column :properties, :sun_start, :float, default: 0.0
change_column :properties, :sun_end, :float, default: 0.0

remove_column :setups, :hours_in_advance

change_column :users, :is_admin, :boolean, default: false
----------------------------------

What now: [g]enerate migration, generate and [m]igrate now or [c]ancel? m
  => "m"

Migration filename: [<enter>=hobo_migration_10|<custom_name>]:
  => "hobo_migration_10"
      create db/migrate/20160311192034_hobo_migration_10.rb
        rake  db:migrate
== 20160311192034 HoboMigration10: migrating ==================================
-- change_column(:appointments, :completed, :boolean, {:default=>false})
   -> 0.0093s
-- change_column(:appointments, :cancelled, :boolean, {:default=>false})
   -> 0.0045s
-- change_column(:properties, :mon_start, :float, {:default=>0})
   -> 0.0067s
-- change_column(:properties, :mon_end, :float, {:default=>0})
   -> 0.0062s
-- change_column(:properties, :tue_start, :float, {:default=>0})
   -> 0.0063s
-- change_column(:properties, :tue_end, :float, {:default=>0})
   -> 0.0068s
-- change_column(:properties, :wed_start, :float, {:default=>0})
   -> 0.0060s
-- change_column(:properties, :wed_end, :float, {:default=>0})
   -> 0.0064s
-- change_column(:properties, :thu_start, :float, {:default=>0})
   -> 0.0060s
-- change_column(:properties, :thu_end, :float, {:default=>0})
   -> 0.0061s
-- change_column(:properties, :fri_start, :float, {:default=>0})
   -> 0.0065s
-- change_column(:properties, :fri_end, :float, {:default=>0})
   -> 0.0076s
-- change_column(:properties, :sat_start, :float, {:default=>0})
   -> 0.0089s
-- change_column(:properties, :sat_end, :float, {:default=>0})
   -> 0.0090s
-- change_column(:properties, :sun_start, :float, {:default=>0})
   -> 0.0079s
-- change_column(:properties, :sun_end, :float, {:default=>0})
   -> 0.0101s
-- add_column(:setups, :hours_in_advance, :integer)
   -> 0.0025s
-- change_column(:users, :is_admin, :boolean, {:default=>false})
   -> 0.0129s
== 20160311192034 HoboMigration10: migrated (0.1334s) =========================


I searched all of the models in the app, and the fields shown above are all the fields with default values. None are missing.

I am using PostgreSQL 9.3.4 if that makes a difference.

As I said, this is a minor annoyance, but I always worry when things that don't have to be changed are changed. Just one more thing that can go wrong .... go wrong .... go..... wrdna..... NO CARRIER ;)

Don Ziesig





--

**

*Henry Baragar*

Director, Software Development

*CSE* | *Canadian Securities Exchange*

*D *(647) 729-8325

220 Bay Street, 9th Floor | Toronto | ON | Canada | M5J 2W4

www.thecse.com <http://www.thecse.com/> | @CSE_News <https://twitter.com/CSE_News>

--
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to hobousers+unsubscr...@googlegroups.com.
To post to this group, send email to hobousers@googlegroups.com.
Visit this group at https://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to