FogBugz #78: ActiveAdmin gem added. Initial setup done. Still needs some tweaking.
This commit is contained in:
parent
4a644a9a38
commit
6b912b265f
35 changed files with 22756 additions and 9330 deletions
31
db/migrate/20120210222344_devise_create_admin_users.rb
Normal file
31
db/migrate/20120210222344_devise_create_admin_users.rb
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
class DeviseCreateAdminUsers < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table(:admin_users) do |t|
|
||||
t.database_authenticatable :null => false
|
||||
t.recoverable
|
||||
t.rememberable
|
||||
t.trackable
|
||||
|
||||
# t.encryptable
|
||||
# t.confirmable
|
||||
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
|
||||
# t.token_authenticatable
|
||||
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
# Create a default user
|
||||
AdminUser.create!(:email => 'admin@contact-o-rama.com', :password => 'admin.password314', :password_confirmation => 'admin.password314')
|
||||
|
||||
add_index :admin_users, :email, :unique => true
|
||||
add_index :admin_users, :reset_password_token, :unique => true
|
||||
# add_index :admin_users, :confirmation_token, :unique => true
|
||||
# add_index :admin_users, :unlock_token, :unique => true
|
||||
# add_index :admin_users, :authentication_token, :unique => true
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :admin_users
|
||||
end
|
||||
end
|
||||
16
db/migrate/20120210232424_create_admin_notes.rb
Normal file
16
db/migrate/20120210232424_create_admin_notes.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
class CreateAdminNotes < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :admin_notes do |t|
|
||||
t.references :resource, :polymorphic => true, :null => false
|
||||
t.references :admin_user, :polymorphic => true
|
||||
t.text :body
|
||||
t.timestamps
|
||||
end
|
||||
add_index :admin_notes, [:resource_type, :resource_id]
|
||||
add_index :admin_notes, [:admin_user_type, :admin_user_id]
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :admin_notes
|
||||
end
|
||||
end
|
||||
25
db/migrate/20120210232425_move_admin_notes_to_comments.rb
Normal file
25
db/migrate/20120210232425_move_admin_notes_to_comments.rb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
class MoveAdminNotesToComments < ActiveRecord::Migration
|
||||
def self.up
|
||||
remove_index :admin_notes, [:admin_user_type, :admin_user_id]
|
||||
rename_table :admin_notes, :active_admin_comments
|
||||
rename_column :active_admin_comments, :admin_user_type, :author_type
|
||||
rename_column :active_admin_comments, :admin_user_id, :author_id
|
||||
add_column :active_admin_comments, :namespace, :string
|
||||
add_index :active_admin_comments, [:namespace]
|
||||
add_index :active_admin_comments, [:author_type, :author_id]
|
||||
|
||||
# Update all the existing comments to the default namespace
|
||||
say "Updating any existing comments to the #{ActiveAdmin.application.default_namespace} namespace."
|
||||
execute "UPDATE active_admin_comments SET namespace='#{ActiveAdmin.application.default_namespace}'"
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :active_admin_comments, :column => [:author_type, :author_id]
|
||||
remove_index :active_admin_comments, :column => [:namespace]
|
||||
remove_column :active_admin_comments, :namespace
|
||||
rename_column :active_admin_comments, :author_id, :admin_user_id
|
||||
rename_column :active_admin_comments, :author_type, :admin_user_type
|
||||
rename_table :active_admin_comments, :admin_notes
|
||||
add_index :admin_notes, [:admin_user_type, :admin_user_id]
|
||||
end
|
||||
end
|
||||
184
db/schema.rb
184
db/schema.rb
|
|
@ -1,76 +1,108 @@
|
|||
# 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.
|
||||
#
|
||||
# Note that this schema.rb definition is the authoritative source for your
|
||||
# database schema. If you need to create the application database on another
|
||||
# system, you should be using db:schema:load, not running all the migrations
|
||||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20110713200056) do
|
||||
|
||||
create_table "addresses", :force => true do |t|
|
||||
t.string "street"
|
||||
t.string "housenr"
|
||||
t.string "zipcode"
|
||||
t.string "place"
|
||||
t.string "country"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "contacts", :force => true do |t|
|
||||
t.string "firstname"
|
||||
t.string "lastname"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "birth_day"
|
||||
t.integer "birth_month"
|
||||
t.integer "birth_year"
|
||||
t.integer "user_id"
|
||||
t.integer "address_id"
|
||||
end
|
||||
|
||||
add_index "contacts", ["address_id"], :name => "fk_contacts_addresses"
|
||||
|
||||
create_table "emails", :force => true do |t|
|
||||
t.string "desc"
|
||||
t.string "address"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "contact_id"
|
||||
end
|
||||
|
||||
add_index "emails", ["contact_id"], :name => "fk_emails_contacts"
|
||||
|
||||
create_table "phones", :force => true do |t|
|
||||
t.string "desc"
|
||||
t.string "nr"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
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 "reset_password_token"
|
||||
t.datetime "remember_created_at"
|
||||
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"
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
end
|
||||
# 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.
|
||||
#
|
||||
# Note that this schema.rb definition is the authoritative source for your
|
||||
# database schema. If you need to create the application database on another
|
||||
# system, you should be using db:schema:load, not running all the migrations
|
||||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120210232425) do
|
||||
|
||||
create_table "active_admin_comments", :force => true do |t|
|
||||
t.integer "resource_id", :null => false
|
||||
t.string "resource_type", :null => false
|
||||
t.integer "author_id"
|
||||
t.string "author_type"
|
||||
t.text "body"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "namespace"
|
||||
end
|
||||
|
||||
add_index "active_admin_comments", ["author_type", "author_id"], :name => "index_active_admin_comments_on_author_type_and_author_id"
|
||||
add_index "active_admin_comments", ["namespace"], :name => "index_active_admin_comments_on_namespace"
|
||||
add_index "active_admin_comments", ["resource_type", "resource_id"], :name => "index_admin_notes_on_resource_type_and_resource_id"
|
||||
|
||||
create_table "addresses", :force => true do |t|
|
||||
t.string "street"
|
||||
t.string "housenr"
|
||||
t.string "zipcode"
|
||||
t.string "place"
|
||||
t.string "country"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
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 "reset_password_token"
|
||||
t.datetime "remember_created_at"
|
||||
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"
|
||||
end
|
||||
|
||||
add_index "admin_users", ["email"], :name => "index_admin_users_on_email", :unique => true
|
||||
add_index "admin_users", ["reset_password_token"], :name => "index_admin_users_on_reset_password_token", :unique => true
|
||||
|
||||
create_table "contacts", :force => true do |t|
|
||||
t.string "firstname"
|
||||
t.string "lastname"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "birth_day"
|
||||
t.integer "birth_month"
|
||||
t.integer "birth_year"
|
||||
t.integer "user_id"
|
||||
t.integer "address_id"
|
||||
end
|
||||
|
||||
add_index "contacts", ["address_id"], :name => "fk_contacts_addresses"
|
||||
|
||||
create_table "emails", :force => true do |t|
|
||||
t.string "desc"
|
||||
t.string "address"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "contact_id"
|
||||
end
|
||||
|
||||
add_index "emails", ["contact_id"], :name => "fk_emails_contacts"
|
||||
|
||||
create_table "phones", :force => true do |t|
|
||||
t.string "desc"
|
||||
t.string "nr"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
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 "reset_password_token"
|
||||
t.datetime "remember_created_at"
|
||||
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"
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue