Add default value for alerted attribute
This commit is contained in:
parent
6a68202f1a
commit
9d767141cc
2 changed files with 31 additions and 4 deletions
9
db/migrate/20130407102854_add_default_value.rb
Normal file
9
db/migrate/20130407102854_add_default_value.rb
Normal file
|
@ -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
|
26
db/schema.rb
26
db/schema.rb
|
@ -11,18 +11,29 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# 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|
|
create_table "alerts", :force => true do |t|
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.string "department"
|
t.string "department"
|
||||||
t.string "course"
|
t.string "course"
|
||||||
t.boolean "alerted"
|
t.boolean "alerted", :default => false
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.string "semester"
|
t.string "semester"
|
||||||
end
|
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|
|
create_table "users", :force => true do |t|
|
||||||
t.string "email", :default => "", :null => false
|
t.string "email", :default => "", :null => false
|
||||||
t.string "encrypted_password", :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", ["email"], :name => "index_users_on_email", :unique => true
|
||||||
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :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
|
end
|
||||||
|
|
Loading…
Reference in a new issue