Adjust migrations to Devise 2.0 changes.

This commit is contained in:
Roland Jesse 2012-04-22 23:47:56 +02:00
parent 3a0535a4c1
commit 23cdb107b5
3 changed files with 62 additions and 29 deletions

View file

@ -1,16 +1,40 @@
class DeviseCreateAdminUsers < ActiveRecord::Migration
def self.up
create_table(:admin_users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
# t.encryptable
# t.confirmable
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.token_authenticatable
## Recoverable
t.string :reset_password_token
# t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, :default => 0
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Encryptable
# t.string :password_salt
## Confirmable
# t.string :confirmation_token
# t.datetime :confirmed_at
# t.datetime :confirmation_sent_at
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
# Token authenticatable
# t.string :authentication_token
t.timestamps
end

View file

@ -6,5 +6,7 @@ class UpdateDeviseToVersion2 < ActiveRecord::Migration
add_column :users, :confirmation_sent_at, :datetime
add_column :users, :unconfirmed_email, :string
add_column :users, :reset_password_sent_at, :datetime
add_column :admin_users, :reset_password_sent_at, :datetime
end
end

View file

@ -1,3 +1,4 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
@ -10,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120210232425) do
ActiveRecord::Schema.define(:version => 20120422201818) do
create_table "active_admin_comments", :force => true do |t|
t.integer "resource_id", :null => false
@ -18,8 +19,8 @@ ActiveRecord::Schema.define(:version => 20120210232425) do
t.integer "author_id"
t.string "author_type"
t.text "body"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "namespace"
end
@ -33,22 +34,23 @@ ActiveRecord::Schema.define(:version => 20120210232425) do
t.string "zipcode"
t.string "place"
t.string "country"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "admin_users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
t.string "reset_password_token"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "reset_password_sent_at"
end
add_index "admin_users", ["email"], :name => "index_admin_users_on_email", :unique => true
@ -57,8 +59,8 @@ ActiveRecord::Schema.define(:version => 20120210232425) do
create_table "contacts", :force => true do |t|
t.string "firstname"
t.string "lastname"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "birth_day"
t.integer "birth_month"
t.integer "birth_year"
@ -71,8 +73,8 @@ ActiveRecord::Schema.define(:version => 20120210232425) do
create_table "emails", :force => true do |t|
t.string "desc"
t.string "address"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "contact_id"
end
@ -81,25 +83,30 @@ ActiveRecord::Schema.define(:version => 20120210232425) do
create_table "phones", :force => true do |t|
t.string "desc"
t.string "nr"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "contact_id"
end
add_index "phones", ["contact_id"], :name => "fk_phones_contacts"
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
t.string "reset_password_token"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.datetime "reset_password_sent_at"
end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true