From 9d767141cc72876a7e7de737c97c51c550815bb2 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Sun, 7 Apr 2013 06:30:42 -0400 Subject: [PATCH] Add default value for alerted attribute --- .../20130407102854_add_default_value.rb | 9 +++++++ db/schema.rb | 26 ++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20130407102854_add_default_value.rb diff --git a/db/migrate/20130407102854_add_default_value.rb b/db/migrate/20130407102854_add_default_value.rb new file mode 100644 index 0000000..b83dd58 --- /dev/null +++ b/db/migrate/20130407102854_add_default_value.rb @@ -0,0 +1,9 @@ +class AddDefaultValue < ActiveRecord::Migration + def up + change_column :alerts, :alerted, :boolean, :default => false + end + + def down + change_column :alerts, :alerted, :boolean, :default => nil + end +end diff --git a/db/schema.rb b/db/schema.rb index f4d324a..1eed245 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,18 +11,29 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130406050216) do +ActiveRecord::Schema.define(:version => 20130407102854) do create_table "alerts", :force => true do |t| t.integer "user_id" t.string "department" t.string "course" - t.boolean "alerted" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.boolean "alerted", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "semester" end + create_table "roles", :force => true do |t| + t.string "name" + t.integer "resource_id" + t.string "resource_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "roles", ["name", "resource_type", "resource_id"], :name => "index_roles_on_name_and_resource_type_and_resource_id" + add_index "roles", ["name"], :name => "index_roles_on_name" + create_table "users", :force => true do |t| t.string "email", :default => "", :null => false t.string "encrypted_password", :default => "", :null => false @@ -41,4 +52,11 @@ ActiveRecord::Schema.define(:version => 20130406050216) do add_index "users", ["email"], :name => "index_users_on_email", :unique => true add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + create_table "users_roles", :id => false, :force => true do |t| + t.integer "user_id" + t.integer "role_id" + end + + add_index "users_roles", ["user_id", "role_id"], :name => "index_users_roles_on_user_id_and_role_id" + end