Patch #1587 ยป user_address_list.diff
| test/unit/phone_number_test.rb (revision 0) | ||
|---|---|---|
|
class PhoneNumberTest < Test::Unit::TestCase
|
||
|
fixtures :users
|
||
|
def setup
|
||
|
@user = User.find(:first)
|
||
|
@fox = PhoneNumber.find(1)
|
||
|
end
|
||
|
|
||
|
def test_create
|
||
|
pn = Address.new(:phone_number => "310 555 1212",
|
||
|
:country_code => "001"
|
||
|
:location => "home")
|
||
|
|
||
|
assert pn.save!
|
||
|
end
|
||
|
|
||
|
def test_user
|
||
|
|
||
|
assert_equal 0, @user.phone_numbers.count
|
||
|
@user.phone_numbers << @fox
|
||
|
|
||
|
assert @user.save!
|
||
|
|
||
|
assert_equal 1, @user.phone_numbers.count
|
||
|
|
||
|
end
|
||
|
|
||
|
end
|
||
| test/unit/address_test.rb (revision 0) | ||
|---|---|---|
|
class AddressTest < Test::Unit::TestCase
|
||
|
fixtures :users
|
||
|
def setup
|
||
|
@user = User.find(:first)
|
||
|
@fox = Address.find(1)
|
||
|
end
|
||
|
|
||
|
def test_create
|
||
|
address = Address.new(:street => "123 Fake St.",
|
||
|
:city => "Los Angeles",
|
||
|
:state => "CA",
|
||
|
:postal_code => "90035",
|
||
|
:country => "USA",
|
||
|
:location => "home")
|
||
|
|
||
|
address.street = "321 Vertiable Ave."
|
||
|
|
||
|
|
||
|
assert address.save!
|
||
|
end
|
||
|
|
||
|
def test_user
|
||
|
|
||
|
assert_equal 0, @user.addresses.count
|
||
|
@user.addresses << @fox
|
||
|
|
||
|
assert @user.save!
|
||
|
|
||
|
assert_equal 1, @user.addresses.count
|
||
|
|
||
|
end
|
||
|
|
||
|
end
|
||
| test/unit/im_accounts.rb (revision 0) | ||
|---|---|---|
|
class ImAccountTest < Test::Unit::TestCase
|
||
|
fixtures :users
|
||
|
def setup
|
||
|
@user = User.find(:first)
|
||
|
@im = ImAccount.find(1)
|
||
|
end
|
||
|
|
||
|
def test_create
|
||
|
i = ImAccount.new(:im_name => "testuser@mac.com",
|
||
|
:im_service => "AOL",
|
||
|
:location => "home")
|
||
|
|
||
|
assert i.save!
|
||
|
end
|
||
|
|
||
|
def test_user
|
||
|
|
||
|
assert_equal 0, @user.im_accounts.count
|
||
|
@user.im_accounts << @im
|
||
|
|
||
|
assert @user.save!
|
||
|
|
||
|
assert_equal 1, @user.im_accounts.count
|
||
|
|
||
|
end
|
||
|
|
||
|
end
|
||
| test/functional/users_controller_test.rb (working copy) | ||
|---|---|---|
|
assert_redirected_to 'users/edit/2'
|
||
|
assert_nil Member.find_by_id(1)
|
||
|
end
|
||
|
|
||
|
def test_add_address
|
||
|
get :add_address, :id => 2
|
||
|
assert_not_nil assigns(:address)
|
||
|
assert_response :success
|
||
|
end
|
||
|
|
||
|
def test_add_one_address
|
||
|
assert User.find(2).addresses.size == 0
|
||
|
|
||
|
post :add_address, :id => 2, :address => {:user_id => 2,
|
||
|
:street => "test street", :city => "Los Angeles",
|
||
|
:location => 'work'}
|
||
|
|
||
|
assert_not_nil User.find(2).addresses[0]
|
||
|
assert_not_nil assigns(:address)
|
||
|
assert_response :success
|
||
|
end
|
||
|
|
||
|
def test_add_phone_number
|
||
|
get :add_phone_number, :id => 2
|
||
|
assert_not_nil assigns(:phone_number)
|
||
|
assert_response :success
|
||
|
end
|
||
|
|
||
|
def test_add_one_phone_number
|
||
|
assert User.find(2).phone_numbers.size == 0
|
||
|
|
||
|
post :add_phone_number, :id => 2, :phone_number => {:user_id => 2,
|
||
|
:phone_number => "800 555 1212", :location => 'work'}
|
||
|
|
||
|
assert_not_nil User.find(2).phone_numbers[0]
|
||
|
|
||
|
assert_not_nil assigns(:phone_number)
|
||
|
assert_response :success
|
||
|
end
|
||
|
|
||
|
end
|
||
| test/fixtures/phone_number.yml (revision 0) | ||
|---|---|---|
|
---
|
||
|
phone_number_001:
|
||
|
id: 1
|
||
|
phone_number: "310 369 5000"
|
||
|
country_code: "001"
|
||
|
location: "work"
|
||
| test/fixtures/address.yml (revision 0) | ||
|---|---|---|
|
---
|
||
|
address_001:
|
||
|
id: 1
|
||
|
street: "10201 W. Pico Blvd."
|
||
|
city: "Century City"
|
||
|
state: "CA"
|
||
|
postal_code: "90036"
|
||
|
country: "USA"
|
||
|
location: "work"
|
||
| test/fixtures/im_accounts.yml (revision 0) | ||
|---|---|---|
|
---
|
||
|
im_account_001:
|
||
|
id: 1
|
||
|
im_name: "wildrebel"
|
||
|
im_service: "ICQ"
|
||
| app/helpers/users_helper.rb (working copy) | ||
|---|---|---|
|
|
||
|
def user_settings_tabs
|
||
|
tabs = [{:name => 'general', :partial => 'users/general', :label => :label_general},
|
||
|
{:name => 'memberships', :partial => 'users/memberships', :label => :label_project_plural}
|
||
|
{:name => 'memberships', :partial => 'users/memberships', :label => :label_project_plural},
|
||
|
{:name => 'contact', :partial => 'users/contact', :label => :label_contact}
|
||
|
]
|
||
|
end
|
||
|
end
|
||
| app/models/contact_url.rb (revision 0) | ||
|---|---|---|
|
class ContactUrl < AddressMultiValue
|
||
|
belongs_to :user
|
||
|
end #class
|
||
| app/models/phone_number.rb (revision 0) | ||
|---|---|---|
|
class PhoneNumber < AddressMultiValue
|
||
|
belongs_to :user
|
||
|
validates_presence_of :phone_number
|
||
|
end #class
|
||
| app/models/address.rb (revision 0) | ||
|---|---|---|
|
class Address < AddressMultiValue
|
||
|
belongs_to :user
|
||
|
|
||
|
|
||
|
end #class
|
||
| app/models/user.rb (working copy) | ||
|---|---|---|
|
def time_zone; nil end
|
||
|
def rss_key; nil end
|
||
|
end
|
||
|
class User # my additions
|
||
|
has_many :addresses
|
||
|
has_many :phone_numbers
|
||
|
has_many :im_accounts
|
||
|
has_many :contact_urls
|
||
|
end
|
||
| app/models/im_account.rb (revision 0) | ||
|---|---|---|
|
class ImAccount < AddressMultiValue
|
||
|
belongs_to :user
|
||
|
end #class
|
||
| app/models/address_multi_value.rb (revision 0) | ||
|---|---|---|
|
class AddressMultiValue < ActiveRecord::Base
|
||
|
validates_presence_of :location
|
||
|
|
||
|
end
|
||
| app/controllers/users_controller.rb (working copy) | ||
|---|---|---|
|
Member.find(params[:membership_id]).destroy if request.post?
|
||
|
redirect_to :action => 'edit', :id => @user, :tab => 'memberships'
|
||
|
end
|
||
|
end
|
||
|
|
||
|
|
||
|
def add_address
|
||
|
@user = User.find(params[:id])
|
||
|
if request.post?
|
||
|
@address = Address.new(params[:address])
|
||
|
@address = nil if @address.save
|
||
|
end
|
||
|
@address = PhoneNumber.new(:user => @user) unless @address
|
||
|
end
|
||
|
|
||
|
def add_phone_number
|
||
|
@user = User.find(params[:id])
|
||
|
if request.post?
|
||
|
@phone_number = PhoneNumber.new(params[:phone_number])
|
||
|
@phone_number = nil if @phone_number.save
|
||
|
end
|
||
|
@phone_number = PhoneNumber.new(:user => @user) unless @phone_number
|
||
|
end
|
||
|
def destroy_address
|
||
|
@user = User.find(params[:id])
|
||
|
Address.find(params[:address_id]).destroy
|
||
|
redirect_to :action => 'edit', :id => @user, :tab => 'contact'
|
||
|
end
|
||
|
|
||
|
def destroy_phone_number
|
||
|
@user = User.find(params[:id])
|
||
|
PhoneNumber.find(params[:phone_number_id]).destroy
|
||
|
redirect_to :action => 'edit', :id => @user, :tab => 'contact'
|
||
|
end
|
||
|
|
||
|
end
|
||
| app/views/users/_contact.rhtml (revision 0) | ||
|---|---|---|
|
<div class="splitcontentleft">
|
||
|
<div class="contextual">
|
||
|
<%= link_to l(:label_address_new), {:action => 'add_address', :id => @user}, :class => 'icon icon-add' %>
|
||
|
</div>
|
||
|
<h3><%=h l(:address_plural) %></h3>
|
||
|
<%- if @user.addresses.any? %>
|
||
|
<table class="list memberships">
|
||
|
<tr>
|
||
|
<th style="width:100px"><%= l(:label_locaton) %></th>
|
||
|
<th><%= l(:label_address) %></th>
|
||
|
<th style="width:15%"></th>
|
||
|
</tr>
|
||
|
<%- @user.addresses.each do |address| %>
|
||
|
<tr><td><%=h address.location %></td>
|
||
|
<td><%=h address.street %><br />
|
||
|
<%=h address.city %><%- if address.state %>, <%=h address.state %><%- end %> <%=h address.postal_code %>
|
||
|
</td>
|
||
|
<td>
|
||
|
<%= link_to l(:button_delete), {:action => 'destroy_address', #FIXME!
|
||
|
:id => @user, :address_id => address }, :method => :post, :class => 'icon icon-del' %>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<%- end %>
|
||
|
</table>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
<div class="splitcontentright">
|
||
|
<div class="contextual">
|
||
|
<%= link_to l(:label_phone_number_new), { :action => 'add_phone_number', :id => @user}, :class => 'icon icon-add' %>
|
||
|
</div>
|
||
|
<h3><%=h l(:phone_number_plural) %></h3>
|
||
|
<%- if @user.phone_numbers.any? %>
|
||
|
<table class="list memberships">
|
||
|
<tr>
|
||
|
<th style="width:100px"><%= l(:label_locaton) %></th>
|
||
|
<th><%= l(:label_phone_number) %></th>
|
||
|
<th style="width:15%"></th>
|
||
|
</tr>
|
||
|
<%- @user.phone_numbers.each do |phone_number| %>
|
||
|
<tr><td><%=h phone_number.location %></td>
|
||
|
<td><%=h phone_number.phone_number %></td>
|
||
|
<td>
|
||
|
<%= link_to l(:button_delete), {:action => 'destroy_phone_number',
|
||
|
:id => @user, :phone_number_id => phone_number }, :method => :post, :class => 'icon icon-del' %>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<%- end %>
|
||
|
</table>
|
||
|
<% end %>
|
||
|
</div>
|
||
| app/views/users/add_address.rhtml (revision 0) | ||
|---|---|---|
|
<%= error_messages_for 'address' %>
|
||
|
<h2><%=h l(:add_address )%></h2>
|
||
|
<%- if @user.phone_numbers.any? %>
|
||
|
<h4><%=h l(:address_plural) %></h4>
|
||
|
<table class="list memberships">
|
||
|
<tr>
|
||
|
<th style="width:100px"><%=h l(:field_location)%></th>
|
||
|
<th><%=h l(:field_address)%></th>
|
||
|
<th style="width:15%"></th>
|
||
|
</tr>
|
||
|
<%- @user.addresses.each do |address| %>
|
||
|
<tr><td><%=h address.location %></td>
|
||
|
<td><%=h address.street %><br />
|
||
|
<%=h address.city %><%- if address.state %>, <%=h address.state %><%- end %> <%=h address.postal_code %></td>
|
||
|
<td>
|
||
|
<%= link_to l(:button_delete), {:action => 'destroy_address',
|
||
|
:id => @user, :address_id => address }, :method => :post, :class => 'icon icon-del' %>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<%- end %>
|
||
|
</table>
|
||
|
<% end %>
|
||
|
<%- labelled_tabular_form_for :address, @address, :url => { :action => "add_address" } do |f| %>
|
||
|
<p><%= f.text_field :location , :required => true %></p>
|
||
|
<p><%= f.text_field :street %></p>
|
||
|
<p><%= f.text_field :city %></p>
|
||
|
<p><%= f.text_field :state %></p>
|
||
|
<p><%= f.text_field :postal_code %></p>
|
||
|
<p><%= f.text_field :country %></p>
|
||
|
<%= f.hidden_field :user_id %>
|
||
|
<%= submit_tag l(:button_save_and_add_another) %>
|
||
|
<%= link_to 'Back to Contacts', {:action => :edit, :id => @user, :tab => 'contact'} %>
|
||
|
<%- end %>
|
||
| app/views/users/add_phone_number.rhtml (revision 0) | ||
|---|---|---|
|
<%= error_messages_for 'phone_number' %>
|
||
|
<h2><%=h l(:add_phone_number )%></h2>
|
||
|
<%- if @user.phone_numbers.any? %>
|
||
|
<h4><%=h l(:phone_number_plural) %></h4>
|
||
|
<table class="list memberships">
|
||
|
<tr>
|
||
|
<th style="width:100px"><%=h l(:field_location)%></th>
|
||
|
<th><%=h l(:field_phone_number)%></th>
|
||
|
<th style="width:15%"></th>
|
||
|
</tr>
|
||
|
<%- @user.phone_numbers.each do |phone_number| %>
|
||
|
<tr><td><%=h phone_number.location %></td>
|
||
|
<td><%=h phone_number.phone_number %></td>
|
||
|
<td>
|
||
|
<%= link_to l(:button_delete), {:action => 'destroy_phone_number',
|
||
|
:id => @user, :phone_number_id => phone_number }, :method => :post, :class => 'icon icon-del' %>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<%- end %>
|
||
|
</table>
|
||
|
<% end %>
|
||
|
<%- labelled_tabular_form_for :phone_number, @phone_number, :url => { :action => "add_phone_number" } do |f| %>
|
||
|
<p><%= f.text_field :location , :required => true %></p>
|
||
|
<p><%= f.text_field :phone_number , :required => true %></p>
|
||
|
<%= f.hidden_field :user_id %>
|
||
|
<%= submit_tag l(:button_save_and_add_another) %>
|
||
|
<%= link_to 'Back to Contacts', {:action => :edit, :id => @user, :tab => 'contact'} %>
|
||
|
<%- end %>
|
||
| lang/en.yml (working copy) | ||
|---|---|---|
|
enumeration_issue_priorities: Issue priorities
|
||
|
enumeration_doc_categories: Document categories
|
||
|
enumeration_activities: Activities (time tracking)
|
||
|
label_contact: "Contact"
|
||
|
label_address_new: "New address"
|
||
|
label_phone_number_new: "New phone number"
|
||
|
field_location: "Location"
|
||
|
field_phone_number: "Phone number"
|
||
|
field_street: "Street"
|
||
|
field_city: "City"
|
||
|
field_state: "State"
|
||
|
field_postal_code: "Postal Code"
|
||
|
field_country: "Country"
|
||
|
address_plural: "Addresses"
|
||
|
phone_number_plural: "Phone Numbers"
|
||
|
add_address: "Add Address"
|
||
|
add_phone_number: "Add Phone Number"
|
||
|
button_save_and_add_another: "Save and Add Another"
|
||
|
button_save_and_return: "Save and Return"
|
||
| db/schema.rb (revision 0) | ||
|---|---|---|
|
# 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 => 20080705072348) do
|
||
|
create_table "address_multi_values", :force => true do |t|
|
||
|
t.string "street"
|
||
|
t.string "city"
|
||
|
t.string "state"
|
||
|
t.string "postal_code"
|
||
|
t.string "country"
|
||
|
t.string "country_code"
|
||
|
t.string "phone_number"
|
||
|
t.string "url"
|
||
|
t.string "im_name"
|
||
|
t.string "im_service"
|
||
|
t.string "location"
|
||
|
t.integer "user_id"
|
||
|
t.string "type"
|
||
|
t.datetime "created_at"
|
||
|
t.datetime "updated_at"
|
||
|
end
|
||
|
create_table "attachments", :force => true do |t|
|
||
|
t.integer "container_id", :default => 0, :null => false
|
||
|
t.string "container_type", :limit => 30, :default => "", :null => false
|
||
|
t.string "filename", :default => "", :null => false
|
||
|
t.string "disk_filename", :default => "", :null => false
|
||
|
t.integer "filesize", :default => 0, :null => false
|
||
|
t.string "content_type", :default => ""
|
||
|
t.string "digest", :limit => 40, :default => "", :null => false
|
||
|
t.integer "downloads", :default => 0, :null => false
|
||
|
t.integer "author_id", :default => 0, :null => false
|
||
|
t.datetime "created_on"
|
||
|
t.string "description"
|
||
|
end
|
||
|
create_table "auth_sources", :force => true do |t|
|
||
|
t.string "type", :limit => 30, :default => "", :null => false
|
||
|
t.string "name", :limit => 60, :default => "", :null => false
|
||
|
t.string "host", :limit => 60
|
||
|
t.integer "port"
|
||
|
t.string "account"
|
||
|
t.string "account_password", :limit => 60
|
||
|
t.string "base_dn"
|
||
|
t.string "attr_login", :limit => 30
|
||
|
t.string "attr_firstname", :limit => 30
|
||
|
t.string "attr_lastname", :limit => 30
|
||
|
t.string "attr_mail", :limit => 30
|
||
|
t.boolean "onthefly_register", :default => false, :null => false
|
||
|
t.boolean "tls", :default => false, :null => false
|
||
|
end
|
||
|
create_table "boards", :force => true do |t|
|
||
|
t.integer "project_id", :null => false
|
||
|
t.string "name", :default => "", :null => false
|
||
|
t.string "description"
|
||
|
t.integer "position", :default => 1
|
||
|
t.integer "topics_count", :default => 0, :null => false
|
||
|
t.integer "messages_count", :default => 0, :null => false
|
||
|
t.integer "last_message_id"
|
||
|
end
|
||
|
add_index "boards", ["project_id"], :name => "altered_boards_project_id"
|
||
|
create_table "changes", :force => true do |t|
|
||
|
t.integer "changeset_id", :null => false
|
||
|
t.string "action", :limit => 1, :default => "", :null => false
|
||
|
t.string "path", :default => "", :null => false
|
||
|
t.string "from_path"
|
||
|
t.string "from_revision"
|
||
|
t.string "revision"
|
||
|
t.string "branch"
|
||
|
end
|
||
|
add_index "changes", ["changeset_id"], :name => "changesets_changeset_id"
|
||
|
create_table "changesets", :force => true do |t|
|
||
|
t.integer "repository_id", :null => false
|
||
|
t.string "revision", :null => false
|
||
|
t.string "committer"
|
||
|
t.datetime "committed_on", :null => false
|
||
|
t.text "comments"
|
||
|
t.date "commit_date"
|
||
|
t.string "scmid"
|
||
|
end
|
||
|
add_index "changesets", ["repository_id", "revision"], :name => "altered_changesets_repos_rev", :unique => true
|
||
|
create_table "changesets_issues", :id => false, :force => true do |t|
|
||
|
t.integer "changeset_id", :null => false
|
||
|
t.integer "issue_id", :null => false
|
||
|
end
|
||
|
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
|
||
|
create_table "comments", :force => true do |t|
|
||
|
t.string "commented_type", :limit => 30, :default => "", :null => false
|
||
|
t.integer "commented_id", :default => 0, :null => false
|
||
|
t.integer "author_id", :default => 0, :null => false
|
||
|
t.text "comments"
|
||
|
t.datetime "created_on", :null => false
|
||
|
t.datetime "updated_on", :null => false
|
||
|
end
|
||
|
create_table "custom_fields", :force => true do |t|
|
||
|
t.string "type", :limit => 30, :default => "", :null => false
|
||
|
t.string "name", :limit => 30, :default => "", :null => false
|
||
|
t.string "field_format", :limit => 30, :default => "", :null => false
|
||
|
t.text "possible_values"
|
||
|
t.string "regexp", :default => ""
|
||
|
t.integer "min_length", :default => 0, :null => false
|
||
|
t.integer "max_length", :default => 0, :null => false
|
||
|
t.boolean "is_required", :default => false, :null => false
|
||
|
t.boolean "is_for_all", :default => false, :null => false
|
||
|
t.boolean "is_filter", :default => false, :null => false
|
||
|
t.integer "position", :default => 1
|
||
|
t.boolean "searchable", :default => false
|
||
|
t.text "default_value"
|
||
|
end
|
||
|
create_table "custom_fields_projects", :id => false, :force => true do |t|
|
||
|
t.integer "custom_field_id", :default => 0, :null => false
|
||
|
t.integer "project_id", :default => 0, :null => false
|
||
|
end
|
||
|
create_table "custom_fields_trackers", :id => false, :force => true do |t|
|
||
|
t.integer "custom_field_id", :default => 0, :null => false
|
||
|
t.integer "tracker_id", :default => 0, :null => false
|
||
|
end
|
||
|
create_table "custom_values", :force => true do |t|
|
||
|
t.string "customized_type", :limit => 30, :default => "", :null => false
|
||
|
t.integer "customized_id", :default => 0, :null => false
|
||
|
t.integer "custom_field_id", :default => 0, :null => false
|
||
|
t.text "value"
|
||
|
end
|
||
|
add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized"
|
||
|
create_table "documents", :force => true do |t|
|
||
|
t.integer "project_id", :default => 0, :null => false
|
||
|
t.integer "category_id", :default => 0, :null => false
|
||
|
t.string "title", :limit => 60, :default => "", :null => false
|
||
|
t.text "description"
|
||
|
t.datetime "created_on"
|
||
|
end
|
||
|
add_index "documents", ["project_id"], :name => "documents_project_id"
|
||
|
create_table "enabled_modules", :force => true do |t|
|
||
|
t.integer "project_id"
|
||
|
t.string "name", :null => false
|
||
|
end
|
||
|
add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id"
|
||
|
create_table "enumerations", :force => true do |t|
|
||
|
t.string "opt", :limit => 4, :default => "", :null => false
|
||
|
t.string "name", :limit => 30, :default => "", :null => false
|
||
|
t.integer "position", :default => 1
|
||
|
t.boolean "is_default", :default => false, :null => false
|
||
|
end
|
||
|
create_table "issue_categories", :force => true do |t|
|
||
|
t.integer "project_id", :default => 0, :null => false
|
||
|
t.string "name", :limit => 30, :default => "", :null => false
|
||
|
t.integer "assigned_to_id"
|
||
|
end
|
||
|
add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id"
|
||
|
create_table "issue_relations", :force => true do |t|
|
||
|
t.integer "issue_from_id", :null => false
|
||
|
t.integer "issue_to_id", :null => false
|
||
|
t.string "relation_type", :default => "", :null => false
|
||
|
t.integer "delay"
|
||
|
end
|
||
|
create_table "issue_statuses", :force => true do |t|
|
||
|
t.string "name", :limit => 30, :default => "", :null => false
|
||
|
t.boolean "is_closed", :default => false, :null => false
|
||
|
t.boolean "is_default", :default => false, :null => false
|
||
|
t.integer "position", :default => 1
|
||
|
end
|
||
|
create_table "issues", :force => true do |t|
|
||
|
t.integer "tracker_id", :default => 0, :null => false
|
||
|
t.integer "project_id", :default => 0, :null => false
|
||
|
t.string "subject", :default => "", :null => false
|
||
|
t.text "description"
|
||
|
t.date "due_date"
|
||
|
t.integer "category_id"
|
||
|
t.integer "status_id", :default => 0, :null => false
|
||
|
t.integer "assigned_to_id"
|
||
|
t.integer "priority_id", :default => 0, :null => false
|
||
|
t.integer "fixed_version_id"
|
||
|
t.integer "author_id", :default => 0, :null => false
|
||
|
t.integer "lock_version", :default => 0, :null => false
|
||
|
t.datetime "created_on"
|
||
|
t.datetime "updated_on"
|
||
|
t.date "start_date"
|
||
|
t.integer "done_ratio", :default => 0, :null => false
|
||
|
t.float "estimated_hours"
|
||
|
end
|
||
|
add_index "issues", ["project_id"], :name => "issues_project_id"
|
||
|
create_table "journal_details", :force => true do |t|
|
||
|
t.integer "journal_id", :default => 0, :null => false
|
||
|
t.string "property", :limit => 30, :default => "", :null => false
|
||
|
t.string "prop_key", :limit => 30, :default => "", :null => false
|
||
|
t.string "old_value"
|
||
|
t.string "value"
|
||
|
end
|
||
|
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
|
||
|
create_table "journals", :force => true do |t|
|
||
|
t.integer "journalized_id", :default => 0, :null => false
|
||
|
t.string "journalized_type", :limit => 30, :default => "", :null => false
|
||
|
t.integer "user_id", :default => 0, :null => false
|
||
|
t.text "notes"
|
||
|
t.datetime "created_on", :null => false
|
||
|
end
|
||
|
add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id"
|
||
|
create_table "members", :force => true do |t|
|
||
|
t.integer "user_id", :default => 0, :null => false
|
||
|
t.integer "project_id", :default => 0, :null => false
|
||
|
t.integer "role_id", :default => 0, :null => false
|
||
|
t.datetime "created_on"
|
||
|
t.boolean "mail_notification", :default => false, :null => false
|
||
|
end
|
||
|
create_table "messages", :force => true do |t|
|
||
|
t.integer "board_id", :null => false
|
||
|
t.integer "parent_id"
|
||
|
t.string "subject", :default => "", :null => false
|
||
|
t.text "content"
|
||
|
t.integer "author_id"
|
||
|
t.integer "replies_count", :default => 0, :null => false
|
||
|
t.integer "last_reply_id"
|
||
|
t.datetime "created_on", :null => false
|
||
|
t.datetime "updated_on", :null => false
|
||
|
t.boolean "locked", :default => false
|
||
|
t.integer "sticky", :default => 0
|
||
|
end
|
||
|
add_index "messages", ["parent_id"], :name => "messages_parent_id"
|
||
|
add_index "messages", ["board_id"], :name => "messages_board_id"
|
||
|
create_table "news", :force => true do |t|
|
||
|
t.integer "project_id"
|
||
|
t.string "title", :limit => 60, :default => "", :null => false
|
||
|
t.string "summary", :default => ""
|
||
|
t.text "description"
|
||
|
t.integer "author_id", :default => 0, :null => false
|
||
|
t.datetime "created_on"
|
||
|
t.integer "comments_count", :default => 0, :null => false
|
||
|
end
|
||
|
add_index "news", ["project_id"], :name => "news_project_id"
|
||
|
create_table "projects", :force => true do |t|
|
||
|
t.string "name", :limit => 30, :default => "", :null => false
|
||
|
t.text "description", :limit => 255
|
||
|
t.string "homepage", :default => ""
|
||
|
t.boolean "is_public", :default => true, :null => false
|
||
|
t.integer "parent_id"
|
||
|
t.integer "projects_count", :default => 0
|
||
|
t.datetime "created_on"
|
||
|
t.datetime "updated_on"
|
||
|
t.string "identifier", :limit => 20
|
||
|
t.integer "status", :default => 1, :null => false
|
||
|
end
|
||
|
create_table "projects_trackers", :id => false, :force => true do |t|
|
||
|
t.integer "project_id", :default => 0, :null => false
|
||
|
t.integer "tracker_id", :default => 0, :null => false
|
||
|
end
|
||
|
add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id"
|
||
|
create_table "queries", :force => true do |t|
|
||
|
t.integer "project_id"
|
||
|
t.string "name", :default => "", :null => false
|
||
|
t.text "filters"
|
||
|
t.integer "user_id", :default => 0, :null => false
|
||
|
t.boolean "is_public", :default => false, :null => false
|
||
|
t.text "column_names"
|
||
|
end
|
||
|
create_table "repositories", :force => true do |t|
|
||
|
t.integer "project_id", :default => 0, :null => false
|
||
|
t.string "url", :default => "", :null => false
|
||
|
t.string "login", :limit => 60, :default => ""
|
||
|
t.string "password", :limit => 60, :default => ""
|
||
|
t.string "root_url", :default => ""
|
||
|
t.string "type"
|
||
|
end
|
||
|
create_table "roles", :force => true do |t|
|
||
|
t.string "name", :limit => 30, :default => "", :null => false
|
||
|
t.integer "position", :default => 1
|
||
|
t.boolean "assignable", :default => true
|
||
|
t.integer "builtin", :default => 0, :null => false
|
||
|
t.text "permissions"
|
||
|
end
|
||
|
create_table "settings", :force => true do |t|
|
||
|
t.string "name", :limit => 30, :default => "", :null => false
|
||
|
t.text "value"
|
||
|
t.datetime "updated_on"
|
||
|
end
|
||
|
create_table "time_entries", :force => true do |t|
|
||
|
t.integer "project_id", :null => false
|
||
|
t.integer "user_id", :null => false
|
||
|
t.integer "issue_id"
|
||
|
t.float "hours", :null => false
|
||
|
t.string "comments"
|
||
|
t.integer "activity_id", :null => false
|
||
|
t.date "spent_on", :null => false
|
||
|
t.integer "tyear", :null => false
|
||
|
t.integer "tmonth", :null => false
|
||
|
t.integer "tweek", :null => false
|
||
|
t.datetime "created_on", :null => false
|
||
|
t.datetime "updated_on", :null => false
|
||
|
end
|
||
|
add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id"
|
||
|
add_index "time_entries", ["project_id"], :name => "time_entries_project_id"
|
||
|
create_table "tokens", :force => true do |t|
|
||
|
t.integer "user_id", :default => 0, :null => false
|
||
|
t.string "action", :limit => 30, :default => "", :null => false
|
||
|
t.string "value", :limit => 40, :default => "", :null => false
|
||
|
t.datetime "created_on", :null => false
|
||
|
end
|
||
|
create_table "trackers", :force => true do |t|
|
||
|
t.string "name", :limit => 30, :default => "", :null => false
|
||
|
t.boolean "is_in_chlog", :default => false, :null => false
|
||
|
t.integer "position", :default => 1
|
||
|
t.boolean "is_in_roadmap", :default => true, :null => false
|
||
|
end
|
||
|
create_table "user_preferences", :force => true do |t|
|
||
|
t.integer "user_id", :default => 0, :null => false
|
||
|
t.text "others"
|
||
|
t.boolean "hide_mail", :default => false
|
||
|
t.string "time_zone"
|
||
|
end
|
||
|
create_table "users", :force => true do |t|
|
||
|
t.string "login", :limit => 30, :default => "", :null => false
|
||
|
t.string "hashed_password", :limit => 40, :default => "", :null => false
|
||
|
t.string "firstname", :limit => 30, :default => "", :null => false
|
||
|
t.string "lastname", :limit => 30, :default => "", :null => false
|
||
|
t.string "mail", :limit => 60, :default => "", :null => false
|
||
|
t.boolean "mail_notification", :default => true, :null => false
|
||
|
t.boolean "admin", :default => false, :null => false
|
||
|
t.integer "status", :default => 1, :null => false
|
||
|
t.datetime "last_login_on"
|
||
|
t.string "language", :limit => 5, :default => ""
|
||
|
t.integer "auth_source_id"
|
||
|
t.datetime "created_on"
|
||
|
t.datetime "updated_on"
|
||
|
t.string "type"
|
||
|
end
|
||
|
create_table "versions", :force => true do |t|
|
||
|
t.integer "project_id", :default => 0, :null => false
|
||
|
t.string "name", :default => "", :null => false
|
||
|
t.string "description", :default => ""
|
||
|
t.date "effective_date"
|
||
|
t.datetime "created_on"
|
||
|
t.datetime "updated_on"
|
||
|
t.string "wiki_page_title"
|
||
|
end
|
||
|
add_index "versions", ["project_id"], :name => "altered_versions_project_id"
|
||
|
create_table "watchers", :force => true do |t|
|
||
|
t.string "watchable_type", :default => "", :null => false
|
||
|
t.integer "watchable_id", :default => 0, :null => false
|
||
|
t.integer "user_id"
|
||
|
end
|
||
|
create_table "wiki_content_versions", :force => true do |t|
|
||
|
t.integer "wiki_content_id", :null => false
|
||
|
t.integer "page_id", :null => false
|
||
|
t.integer "author_id"
|
||
|
t.binary "data"
|
||
|
t.string "compression", :limit => 6, :default => ""
|
||
|
t.string "comments", :default => ""
|
||
|
t.datetime "updated_on", :null => false
|
||
|
t.integer "version", :null => false
|
||
|
end
|
||
|
add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid"
|
||
|
create_table "wiki_contents", :force => true do |t|
|
||
|
t.integer "page_id", :null => false
|
||
|
t.integer "author_id"
|
||
|
t.text "text"
|
||
|
t.string "comments", :default => ""
|
||
|
t.datetime "updated_on", :null => false
|
||
|
t.integer "version", :null => false
|
||
|
end
|
||
|
add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id"
|
||
|
create_table "wiki_pages", :force => true do |t|
|
||
|
t.integer "wiki_id", :null => false
|
||
|
t.string "title", :null => false
|
||
|
t.datetime "created_on", :null => false
|
||
|
t.boolean "protected", :default => false, :null => false
|
||
|
end
|
||
|
add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title"
|
||
|
create_table "wiki_redirects", :force => true do |t|
|
||
|
t.integer "wiki_id", :null => false
|
||
|
t.string "title"
|
||
|
t.string "redirects_to"
|
||
|
t.datetime "created_on", :null => false
|
||
|
end
|
||
|
add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title"
|
||
|
create_table "wikis", :force => true do |t|
|
||
|
t.integer "project_id", :null => false
|
||
|
t.string "start_page", :null => false
|
||
|
t.integer "status", :default => 1, :null => false
|
||
|
end
|
||
|
add_index "wikis", ["project_id"], :name => "wikis_project_id"
|
||
|
create_table "workflows", :force => true do |t|
|
||
|
t.integer "tracker_id", :default => 0, :null => false
|
||
|
t.integer "old_status_id", :default => 0, :null => false
|
||
|
t.integer "new_status_id", :default => 0, :null => false
|
||
|
t.integer "role_id", :default => 0, :null => false
|
||
|
end
|
||
|
add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status"
|
||
|
end
|
||
| db/migrate/20080705072348_create_address_multi_values.rb (revision 0) | ||
|---|---|---|
|
class CreateAddressMultiValues < ActiveRecord::Migration
|
||
|
def self.up
|
||
|
create_table :address_multi_values do |t|
|
||
|
t.string :street
|
||
|
t.string :city
|
||
|
t.string :state
|
||
|
t.string :postal_code
|
||
|
t.string :country
|
||
|
t.string :country_code
|
||
|
t.string :phone_number
|
||
|
t.string :url
|
||
|
t.string :im_name
|
||
|
t.string :im_service
|
||
|
t.string :location
|
||
|
t.integer :user_id
|
||
|
t.string :type
|
||
|
|
||
|
t.timestamps
|
||
|
end
|
||
|
end
|
||
|
def self.down
|
||
|
drop_table :address_multi_values
|
||
|
end
|
||
|
end
|
||