Trying to get authlogic running

This commit is contained in:
Christoph Haas 2015-07-13 18:42:36 +02:00
parent 06f09c0486
commit 737ff62cfc
23 changed files with 306 additions and 4 deletions

View file

@ -0,0 +1,23 @@
class ChangeUsersToAuthlogic < ActiveRecord::Migration
def change
change_table :users do |t|
# Remove the password column that was previously introduced
t.remove :password
# Create AuthLogic fields
t.string :password_salt, :null => false # optional, but highly recommended
t.string :persistence_token, :null => false # required
# Magic columns, just like ActiveRecord's created_at and updated_at. These are automatically maintained by Authlogic if they are present.
t.integer :login_count, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
t.integer :failed_login_count, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
t.datetime :last_request_at # optional, see Authlogic::Session::MagicColumns
t.datetime :current_login_at # optional, see Authlogic::Session::MagicColumns
t.datetime :last_login_at # optional, see Authlogic::Session::MagicColumns
t.string :current_login_ip # optional, see Authlogic::Session::MagicColumns
t.string :last_login_ip # optional, see Authlogic::Session::MagicColumns
end
change_column :packages, :long_description, :text
end
end

View file

@ -0,0 +1,13 @@
class CreateUserSessions < ActiveRecord::Migration
def change
create_table :user_sessions do |t|
t.string :session_id, :null => false
t.text :data
t.timestamps
end
add_index :user_sessions, :session_id
add_index :user_sessions, :updated_at
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150628113425) do
ActiveRecord::Schema.define(version: 20150713155458) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -64,12 +64,30 @@ ActiveRecord::Schema.define(version: 20150628113425) do
add_index "screenshots", ["id", "approved"], name: "id_approved", using: :btree
add_index "screenshots", ["id", "uploaderhash"], name: "id_uploaderhash", using: :btree
create_table "user_sessions", force: :cascade do |t|
t.string "session_id", null: false
t.text "data"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "user_sessions", ["session_id"], name: "index_user_sessions_on_session_id", using: :btree
add_index "user_sessions", ["updated_at"], name: "index_user_sessions_on_updated_at", using: :btree
create_table "users", force: :cascade do |t|
t.text "email"
t.text "realname"
t.text "password"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "password_salt", null: false
t.string "persistence_token", null: false
t.integer "login_count", default: 0, null: false
t.integer "failed_login_count", default: 0, null: false
t.datetime "last_request_at"
t.datetime "current_login_at"
t.datetime "last_login_at"
t.string "current_login_ip"
t.string "last_login_ip"
end
add_foreign_key "screenshots", "packages", name: "screenshots_package_id_fkey"