summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjomo <github@jomo.tv>2015-04-24 00:43:29 +0200
committerjomo <github@jomo.tv>2015-04-24 00:43:29 +0200
commitd1c360959fc583d699d3fb018d1d12f89e5fe00f (patch)
treec6fcd1343c9e1631ba2829ce6d572a3318510e0c
parent542b235f238d5f1837b65b529cf53e31efbc228d (diff)
maybe I should add migrations...
-rw-r--r--db/migrate/20150423221202_add_timestamps_to_info.rb6
-rw-r--r--db/migrate/20150423221613_add_timestamps_to_existing_info.rb7
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