Add heartbeat model, next_heartbeat_time and update_heartbeat_time on device registration

This commit is contained in:
leenasn
2015-11-09 13:43:21 +05:30
parent 185b10d8e7
commit 0e8b403142
11 changed files with 89 additions and 4 deletions

View File

@@ -0,0 +1,9 @@
class CreateHeartbeats < ActiveRecord::Migration
def change
create_table :heartbeats do |t|
t.references :device, index: true, foreign_key: true
t.timestamps null: false
end
end
end

View File

@@ -0,0 +1,6 @@
class AddHeartbeatsDetailsToDevices < ActiveRecord::Migration
def change
add_column :devices, :heartbeats_count, :integer, default: 0
add_column :devices, :last_heartbeat_recd_time, :datetime
end
end