Donald Ziesig
unread,Mar 11, 2016, 2:33:03 PM3/11/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Hobo Users
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