diff --git a/app/models/data_point.rb b/app/models/data_point.rb new file mode 100644 index 000000000..3dfc32d37 --- /dev/null +++ b/app/models/data_point.rb @@ -0,0 +1,6 @@ +class DataPoint < ActiveRecord::Base + attr_accessor :descriptor + attr_accessor :value + + belongs_to :statistic +end diff --git a/app/models/statistc.rb b/app/models/statistc.rb new file mode 100644 index 000000000..65ea33dad --- /dev/null +++ b/app/models/statistc.rb @@ -0,0 +1,5 @@ +class Statistc < ActiveRecord::Base + attr_accessor :average + + has_many :data_points, :class_name => 'DataPoint' +end diff --git a/db/migrate/20110120181553_create_statistcs.rb b/db/migrate/20110120181553_create_statistcs.rb new file mode 100644 index 000000000..0313ebf43 --- /dev/null +++ b/db/migrate/20110120181553_create_statistcs.rb @@ -0,0 +1,14 @@ +class CreateStatistcs < ActiveRecord::Migration + def self.up + create_table :statistcs do |t| + t.integer :average + t.string :type + + t.timestamps + end + end + + def self.down + drop_table :statistcs + end +end diff --git a/db/migrate/20110120182100_create_data_points.rb b/db/migrate/20110120182100_create_data_points.rb new file mode 100644 index 000000000..5d1c248b2 --- /dev/null +++ b/db/migrate/20110120182100_create_data_points.rb @@ -0,0 +1,17 @@ +class CreateDataPoints < ActiveRecord::Migration + def self.up + create_table :data_points do |t| + t.string :descriptor + t.integer :value + t.integer :statistic_id + + t.timestamps + end + add_index :data_points, :statistic_id + end + + def self.down + remove_index :data_points, :statistic_id + drop_table :data_points + end +end diff --git a/db/schema.rb b/db/schema.rb index d356b341e..0a07ab14b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110119221746) do +ActiveRecord::Schema.define(:version => 20110120182100) do create_table "aspect_memberships", :force => true do |t| t.integer "aspect_id" @@ -67,6 +67,16 @@ ActiveRecord::Schema.define(:version => 20110119221746) do add_index "contacts", ["user_id", "pending"], :name => "index_contacts_on_user_id_and_pending" add_index "contacts", ["user_id", "person_id"], :name => "index_contacts_on_user_id_and_person_id", :unique => true + create_table "data_points", :force => true do |t| + t.string "descriptor" + t.integer "value" + t.integer "statistic_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "data_points", ["statistic_id"], :name => "index_data_points_on_statistic_id" + create_table "invitations", :force => true do |t| t.text "message" t.integer "sender_id" @@ -407,6 +417,13 @@ ActiveRecord::Schema.define(:version => 20110119221746) do add_index "services", ["mongo_id"], :name => "index_services_on_mongo_id" add_index "services", ["user_id"], :name => "index_services_on_user_id" + create_table "statistcs", :force => true do |t| + t.integer "average" + t.string "type" + t.datetime "created_at" + t.datetime "updated_at" + end + create_table "users", :force => true do |t| t.string "username" t.text "serialized_private_key" diff --git a/spec/models/data_point_spec.rb b/spec/models/data_point_spec.rb new file mode 100644 index 000000000..c5a630bd2 --- /dev/null +++ b/spec/models/data_point_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe DataPoint do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/statistc_spec.rb b/spec/models/statistc_spec.rb new file mode 100644 index 000000000..92530eb40 --- /dev/null +++ b/spec/models/statistc_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Statistc do + pending "add some examples to (or delete) #{__FILE__}" +end