Skip to content

Commit

Permalink
Add a readings model
Browse files Browse the repository at this point in the history
  • Loading branch information
albus522 committed Nov 22, 2015
1 parent 40e0254 commit f124ffa
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/models/reading.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Reading < ActiveRecord::Base
enum state: [:off, :cooling, :heating]
end
13 changes: 13 additions & 0 deletions db/migrate/20151122190312_create_readings.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class CreateReadings < ActiveRecord::Migration
def change
create_table :readings do |t|
t.integer :state
t.integer :set_temp
t.decimal :temp_f, precision: 6, scale: 3

t.timestamps
end

add_index :readings, :created_at
end
end
12 changes: 11 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,21 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20141119004438) do
ActiveRecord::Schema.define(version: 20151122190312) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "readings", force: true do |t|
t.integer "state"
t.integer "set_temp"
t.decimal "temp_f", precision: 6, scale: 3
t.datetime "created_at"
t.datetime "updated_at"
end

add_index "readings", ["created_at"], name: "index_readings_on_created_at", using: :btree

create_table "set_temps", force: true do |t|
t.integer "mode"
t.integer "temp"
Expand Down

0 comments on commit f124ffa

Please sign in to comment.