diff options
author | jomo <github@jomo.tv> | 2015-04-24 00:43:29 +0200 |
---|---|---|
committer | jomo <github@jomo.tv> | 2015-04-24 00:43:29 +0200 |
commit | d1c360959fc583d699d3fb018d1d12f89e5fe00f (patch) | |
tree | c6fcd1343c9e1631ba2829ce6d572a3318510e0c /db | |
parent | 542b235f238d5f1837b65b529cf53e31efbc228d (diff) |
maybe I should add migrations...
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20150423221202_add_timestamps_to_info.rb | 6 | ||||
-rw-r--r-- | db/migrate/20150423221613_add_timestamps_to_existing_info.rb | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/db/migrate/20150423221202_add_timestamps_to_info.rb b/db/migrate/20150423221202_add_timestamps_to_info.rb new file mode 100644 index 0000000..61a8b58 --- /dev/null +++ b/db/migrate/20150423221202_add_timestamps_to_info.rb @@ -0,0 +1,6 @@ +class AddTimestampsToInfo < ActiveRecord::Migration + def change + add_column :info, :created_at, :datetime + add_column :info, :updated_at, :datetime + end +end
\ No newline at end of file diff --git a/db/migrate/20150423221613_add_timestamps_to_existing_info.rb b/db/migrate/20150423221613_add_timestamps_to_existing_info.rb new file mode 100644 index 0000000..a02a4ae --- /dev/null +++ b/db/migrate/20150423221613_add_timestamps_to_existing_info.rb @@ -0,0 +1,7 @@ +class AddTimestampsToExistingInfo < ActiveRecord::Migration + def change + Info.all.each do |i| + i.update_attributes(created_at: Time.now) + end + end +end |