Project

General

Profile

Patch #1587 ยป user_address_list.diff

diff file, from rev #1628 - Jamie Hardt, 2008-07-05 23:30

View differences:

test/unit/phone_number_test.rb (revision 0)
1
class PhoneNumberTest < Test::Unit::TestCase
2
  fixtures :users
3
  def setup
4
    @user = User.find(:first)
5
    @fox = PhoneNumber.find(1)
6
  end
7
  
8
  def test_create
9
    pn = Address.new(:phone_number => "310 555 1212",
10
                     :country_code => "001"
11
                     :location => "home")
12
    
13
    assert pn.save!
14
  end
15
  
16
  def test_user
17
    
18
    assert_equal 0, @user.phone_numbers.count
19
    @user.phone_numbers << @fox
20
    
21
    assert @user.save!
22
    
23
    assert_equal 1, @user.phone_numbers.count
24
    
25
  end
26
  
27
end
test/unit/address_test.rb (revision 0)
1
class AddressTest < Test::Unit::TestCase
2
  fixtures :users
3
  def setup
4
    @user = User.find(:first)
5
    @fox = Address.find(1)
6
  end
7
  
8
  def test_create
9
    address = Address.new(:street => "123 Fake St.", 
10
                          :city => "Los Angeles",
11
                          :state => "CA",
12
                          :postal_code => "90035",
13
                          :country => "USA",
14
                          :location => "home")
15
    
16
    address.street = "321 Vertiable Ave."
17
    
18
    
19
    assert address.save!
20
  end
21
  
22
  def test_user
23
    
24
    assert_equal 0, @user.addresses.count
25
    @user.addresses << @fox
26
    
27
    assert @user.save!
28
    
29
    assert_equal 1, @user.addresses.count
30
    
31
  end
32
  
33
end
test/unit/im_accounts.rb (revision 0)
1
class ImAccountTest < Test::Unit::TestCase
2
  fixtures :users
3
  def setup
4
    @user = User.find(:first)
5
    @im = ImAccount.find(1)
6
  end
7
  
8
  def test_create
9
    i = ImAccount.new(:im_name => "testuser@mac.com",
10
                      :im_service => "AOL",
11
                      :location => "home")
12
    
13
    assert i.save!
14
  end
15
  
16
  def test_user
17
    
18
    assert_equal 0, @user.im_accounts.count
19
    @user.im_accounts << @im
20
    
21
    assert @user.save!
22
    
23
    assert_equal 1, @user.im_accounts.count
24
    
25
  end
26
  
27
end
test/functional/users_controller_test.rb (working copy)
59 59
    assert_redirected_to 'users/edit/2'
60 60
    assert_nil Member.find_by_id(1)
61 61
  end
62
  
63
  def test_add_address
64
    get :add_address, :id => 2
65
    assert_not_nil assigns(:address)
66
    assert_response :success
67
  end
68
  
69
  def test_add_one_address
70
    assert User.find(2).addresses.size == 0
71
    
72
    post :add_address, :id => 2, :address => {:user_id => 2, 
73
      :street => "test street", :city => "Los Angeles", 
74
      :location => 'work'}
75
    
76
    assert_not_nil User.find(2).addresses[0]
77
    assert_not_nil assigns(:address)
78
    assert_response :success
79
  end
80
  
81
  def test_add_phone_number
82
    get :add_phone_number, :id => 2
83
    assert_not_nil assigns(:phone_number)
84
    assert_response :success
85
  end
86
  
87
  def test_add_one_phone_number
88
    assert User.find(2).phone_numbers.size == 0
89
    
90
    post :add_phone_number, :id => 2, :phone_number => {:user_id => 2, 
91
      :phone_number => "800 555 1212", :location => 'work'}
92
    
93
    assert_not_nil User.find(2).phone_numbers[0]
94
    
95
    assert_not_nil assigns(:phone_number)
96
    assert_response :success
97
  end
98
  
62 99
end
test/fixtures/phone_number.yml (revision 0)
1
---
2
phone_number_001:
3
    id: 1
4
    phone_number: "310 369 5000"
5
    country_code: "001"
6
    location: "work"
test/fixtures/address.yml (revision 0)
1
---
2
address_001:
3
    id: 1
4
    street: "10201 W. Pico Blvd."
5
    city:   "Century City"
6
    state:  "CA"
7
    postal_code:    "90036"
8
    country:    "USA"
9
    location: "work"
test/fixtures/im_accounts.yml (revision 0)
1
---
2
im_account_001:
3
    id: 1
4
    im_name: "wildrebel"
5
    im_service: "ICQ"
app/helpers/users_helper.rb (working copy)
51 51
  
52 52
  def user_settings_tabs
53 53
    tabs = [{:name => 'general', :partial => 'users/general', :label => :label_general},
54
            {:name => 'memberships', :partial => 'users/memberships', :label => :label_project_plural}
54
            {:name => 'memberships', :partial => 'users/memberships', :label => :label_project_plural},
55
            {:name => 'contact', :partial => 'users/contact', :label => :label_contact}
55 56
            ]
56 57
  end
57 58
end
app/models/contact_url.rb (revision 0)
1
class ContactUrl < AddressMultiValue
2
  belongs_to :user
3
end #class
app/models/phone_number.rb (revision 0)
1
class PhoneNumber < AddressMultiValue
2
  belongs_to :user
3
  validates_presence_of :phone_number
4
end #class
app/models/address.rb (revision 0)
1
class Address < AddressMultiValue
2
  belongs_to :user
3
  
4

  
5
  
6
end #class
app/models/user.rb (working copy)
292 292
  def time_zone; nil end
293 293
  def rss_key; nil end
294 294
end
295

  
296
class User # my additions
297
  has_many :addresses
298
  has_many :phone_numbers
299
  has_many :im_accounts
300
  has_many :contact_urls
301
end
app/models/im_account.rb (revision 0)
1
class ImAccount < AddressMultiValue
2
  belongs_to :user
3
end #class
app/models/address_multi_value.rb (revision 0)
1
class AddressMultiValue < ActiveRecord::Base
2
  validates_presence_of :location
3
  
4
end
app/controllers/users_controller.rb (working copy)
98 98
    Member.find(params[:membership_id]).destroy if request.post?
99 99
    redirect_to :action => 'edit', :id => @user, :tab => 'memberships'
100 100
  end
101
end
101
  
102
  
103
  def add_address
104
    @user = User.find(params[:id])
105
    if request.post?
106
      @address = Address.new(params[:address])
107
      @address = nil if @address.save
108
    end
109
    @address = PhoneNumber.new(:user => @user) unless @address
110
  end
111
  
112
  def add_phone_number
113
    @user = User.find(params[:id])
114
    if request.post?
115
      @phone_number = PhoneNumber.new(params[:phone_number])
116
      @phone_number = nil if @phone_number.save
117
    end
118
    @phone_number = PhoneNumber.new(:user => @user) unless @phone_number
119
  end
120

  
121
  def destroy_address
122
    @user = User.find(params[:id])
123
    Address.find(params[:address_id]).destroy
124
    redirect_to :action => 'edit', :id => @user, :tab => 'contact'   
125
  end
126
  
127
  def destroy_phone_number
128
    @user = User.find(params[:id])
129
    PhoneNumber.find(params[:phone_number_id]).destroy
130
    redirect_to :action => 'edit', :id => @user, :tab => 'contact'
131
  end
132
  
133
end
app/views/users/_contact.rhtml (revision 0)
1
<div class="splitcontentleft">
2
	<div class="contextual">
3
	<%= link_to l(:label_address_new), {:action => 'add_address', :id => @user}, :class => 'icon icon-add' %>
4
	</div>
5
<h3><%=h l(:address_plural) %></h3>
6
<%- if @user.addresses.any? %>
7
<table class="list memberships">
8
	<tr>
9
	<th style="width:100px"><%= l(:label_locaton) %></th>
10
	<th><%= l(:label_address) %></th>
11
	<th style="width:15%"></th>
12
	</tr>
13
<%- @user.addresses.each do |address| %>
14
<tr><td><%=h address.location %></td>
15
	<td><%=h address.street %><br />
16
		<%=h address.city %><%- if address.state %>, <%=h address.state %><%- end %> <%=h address.postal_code %>
17
		</td>
18
	<td>
19
		<%= link_to l(:button_delete), {:action => 'destroy_address', #FIXME!
20
			 :id => @user, :address_id => address }, :method => :post, :class => 'icon icon-del' %>
21
	</td>
22
</tr>
23
<%- end %>
24
</table>
25
<% end %>
26
</div>
27
<div class="splitcontentright">
28
<div class="contextual">
29
<%= link_to l(:label_phone_number_new), { :action => 'add_phone_number', :id => @user}, :class => 'icon icon-add' %>
30
</div>
31
<h3><%=h l(:phone_number_plural) %></h3>
32
<%- if @user.phone_numbers.any? %>
33
<table class="list memberships">
34
	<tr>
35
	<th style="width:100px"><%= l(:label_locaton) %></th>
36
	<th><%= l(:label_phone_number) %></th>
37
	<th style="width:15%"></th>
38
	</tr>
39
<%- @user.phone_numbers.each do |phone_number| %>
40
<tr><td><%=h phone_number.location %></td>
41
	<td><%=h phone_number.phone_number %></td>
42
	<td>
43
		<%= link_to l(:button_delete), {:action => 'destroy_phone_number',
44
			 :id => @user, :phone_number_id => phone_number }, :method => :post, :class => 'icon icon-del' %>
45
	</td>
46
</tr>
47
<%- end %>
48
</table>
49
<% end %>
50
</div>
app/views/users/add_address.rhtml (revision 0)
1
<%= error_messages_for 'address' %>
2
<h2><%=h l(:add_address )%></h2>
3
<%- if @user.phone_numbers.any? %>
4
<h4><%=h l(:address_plural) %></h4>
5
<table class="list memberships">
6
	<tr>
7
	<th style="width:100px"><%=h l(:field_location)%></th>
8
	<th><%=h l(:field_address)%></th>
9
	<th style="width:15%"></th>
10
	</tr>
11
<%- @user.addresses.each do |address| %>
12
<tr><td><%=h address.location %></td>
13
	<td><%=h address.street %><br />
14
		<%=h address.city %><%- if address.state %>, <%=h address.state %><%- end %> <%=h address.postal_code %></td>
15
	<td>
16
		<%= link_to l(:button_delete), {:action => 'destroy_address',
17
			 :id => @user, :address_id => address }, :method => :post, :class => 'icon icon-del' %>
18
	</td>
19
</tr>
20
<%- end %>
21
</table>
22
<% end %>
23

  
24
<%- labelled_tabular_form_for :address, @address, :url => { :action => "add_address" } do |f| %>
25
<p><%= f.text_field :location , :required => true %></p>
26
<p><%= f.text_field :street %></p>
27
<p><%= f.text_field :city %></p>
28
<p><%= f.text_field :state %></p>
29
<p><%= f.text_field :postal_code %></p>
30
<p><%= f.text_field :country %></p>
31
<%= f.hidden_field :user_id %>
32
<%= submit_tag l(:button_save_and_add_another) %>
33
<%= link_to 'Back to Contacts', {:action => :edit, :id => @user, :tab => 'contact'} %>
34
<%- end %>
app/views/users/add_phone_number.rhtml (revision 0)
1
<%= error_messages_for 'phone_number' %>
2
<h2><%=h l(:add_phone_number )%></h2>
3
<%- if @user.phone_numbers.any? %>
4
<h4><%=h l(:phone_number_plural) %></h4>
5
<table class="list memberships">
6
	<tr>
7
	<th style="width:100px"><%=h l(:field_location)%></th>
8
	<th><%=h l(:field_phone_number)%></th>
9
	<th style="width:15%"></th>
10
	</tr>
11
<%- @user.phone_numbers.each do |phone_number| %>
12
<tr><td><%=h phone_number.location %></td>
13
	<td><%=h phone_number.phone_number %></td>
14
	<td>
15
		<%= link_to l(:button_delete), {:action => 'destroy_phone_number',
16
			 :id => @user, :phone_number_id => phone_number }, :method => :post, :class => 'icon icon-del' %>
17
	</td>
18
</tr>
19
<%- end %>
20
</table>
21
<% end %>
22

  
23
<%- labelled_tabular_form_for :phone_number, @phone_number, :url => { :action => "add_phone_number" } do |f| %>
24
<p><%= f.text_field :location , :required => true %></p>
25
<p><%= f.text_field :phone_number , :required => true %></p>
26
<%= f.hidden_field :user_id %>
27
<%= submit_tag l(:button_save_and_add_another) %>
28
<%= link_to 'Back to Contacts', {:action => :edit, :id => @user, :tab => 'contact'} %>
29
<%- end %>
lang/en.yml (working copy)
633 633
enumeration_issue_priorities: Issue priorities
634 634
enumeration_doc_categories: Document categories
635 635
enumeration_activities: Activities (time tracking)
636

  
637

  
638
label_contact: "Contact"
639
label_address_new: "New address"
640
label_phone_number_new: "New phone number"
641

  
642
field_location: "Location"
643
field_phone_number: "Phone number"
644

  
645
field_street: "Street"
646
field_city: "City"
647
field_state: "State"
648
field_postal_code: "Postal Code"
649
field_country: "Country"
650

  
651
address_plural: "Addresses"
652
phone_number_plural: "Phone Numbers"
653

  
654
add_address: "Add Address"
655
add_phone_number: "Add Phone Number"
656
button_save_and_add_another: "Save and Add Another"
657
button_save_and_return: "Save and Return"
db/schema.rb (revision 0)
1
# This file is auto-generated from the current state of the database. Instead of editing this file, 
2
# please use the migrations feature of Active Record to incrementally modify your database, and
3
# then regenerate this schema definition.
4
#
5
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
6
# to create the application database on another system, you should be using db:schema:load, not running
7
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8
# you'll amass, the slower it'll run and the greater likelihood for issues).
9
#
10
# It's strongly recommended to check this file into your version control system.
11

  
12
ActiveRecord::Schema.define(:version => 20080705072348) do
13

  
14
  create_table "address_multi_values", :force => true do |t|
15
    t.string   "street"
16
    t.string   "city"
17
    t.string   "state"
18
    t.string   "postal_code"
19
    t.string   "country"
20
    t.string   "country_code"
21
    t.string   "phone_number"
22
    t.string   "url"
23
    t.string   "im_name"
24
    t.string   "im_service"
25
    t.string   "location"
26
    t.integer  "user_id"
27
    t.string   "type"
28
    t.datetime "created_at"
29
    t.datetime "updated_at"
30
  end
31

  
32
  create_table "attachments", :force => true do |t|
33
    t.integer  "container_id",                 :default => 0,  :null => false
34
    t.string   "container_type", :limit => 30, :default => "", :null => false
35
    t.string   "filename",                     :default => "", :null => false
36
    t.string   "disk_filename",                :default => "", :null => false
37
    t.integer  "filesize",                     :default => 0,  :null => false
38
    t.string   "content_type",                 :default => ""
39
    t.string   "digest",         :limit => 40, :default => "", :null => false
40
    t.integer  "downloads",                    :default => 0,  :null => false
41
    t.integer  "author_id",                    :default => 0,  :null => false
42
    t.datetime "created_on"
43
    t.string   "description"
44
  end
45

  
46
  create_table "auth_sources", :force => true do |t|
47
    t.string  "type",              :limit => 30, :default => "",    :null => false
48
    t.string  "name",              :limit => 60, :default => "",    :null => false
49
    t.string  "host",              :limit => 60
50
    t.integer "port"
51
    t.string  "account"
52
    t.string  "account_password",  :limit => 60
53
    t.string  "base_dn"
54
    t.string  "attr_login",        :limit => 30
55
    t.string  "attr_firstname",    :limit => 30
56
    t.string  "attr_lastname",     :limit => 30
57
    t.string  "attr_mail",         :limit => 30
58
    t.boolean "onthefly_register",               :default => false, :null => false
59
    t.boolean "tls",                             :default => false, :null => false
60
  end
61

  
62
  create_table "boards", :force => true do |t|
63
    t.integer "project_id",                      :null => false
64
    t.string  "name",            :default => "", :null => false
65
    t.string  "description"
66
    t.integer "position",        :default => 1
67
    t.integer "topics_count",    :default => 0,  :null => false
68
    t.integer "messages_count",  :default => 0,  :null => false
69
    t.integer "last_message_id"
70
  end
71

  
72
  add_index "boards", ["project_id"], :name => "altered_boards_project_id"
73

  
74
  create_table "changes", :force => true do |t|
75
    t.integer "changeset_id",                               :null => false
76
    t.string  "action",        :limit => 1, :default => "", :null => false
77
    t.string  "path",                       :default => "", :null => false
78
    t.string  "from_path"
79
    t.string  "from_revision"
80
    t.string  "revision"
81
    t.string  "branch"
82
  end
83

  
84
  add_index "changes", ["changeset_id"], :name => "changesets_changeset_id"
85

  
86
  create_table "changesets", :force => true do |t|
87
    t.integer  "repository_id", :null => false
88
    t.string   "revision",      :null => false
89
    t.string   "committer"
90
    t.datetime "committed_on",  :null => false
91
    t.text     "comments"
92
    t.date     "commit_date"
93
    t.string   "scmid"
94
  end
95

  
96
  add_index "changesets", ["repository_id", "revision"], :name => "altered_changesets_repos_rev", :unique => true
97

  
98
  create_table "changesets_issues", :id => false, :force => true do |t|
99
    t.integer "changeset_id", :null => false
100
    t.integer "issue_id",     :null => false
101
  end
102

  
103
  add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
104

  
105
  create_table "comments", :force => true do |t|
106
    t.string   "commented_type", :limit => 30, :default => "", :null => false
107
    t.integer  "commented_id",                 :default => 0,  :null => false
108
    t.integer  "author_id",                    :default => 0,  :null => false
109
    t.text     "comments"
110
    t.datetime "created_on",                                   :null => false
111
    t.datetime "updated_on",                                   :null => false
112
  end
113

  
114
  create_table "custom_fields", :force => true do |t|
115
    t.string  "type",            :limit => 30, :default => "",    :null => false
116
    t.string  "name",            :limit => 30, :default => "",    :null => false
117
    t.string  "field_format",    :limit => 30, :default => "",    :null => false
118
    t.text    "possible_values"
119
    t.string  "regexp",                        :default => ""
120
    t.integer "min_length",                    :default => 0,     :null => false
121
    t.integer "max_length",                    :default => 0,     :null => false
122
    t.boolean "is_required",                   :default => false, :null => false
123
    t.boolean "is_for_all",                    :default => false, :null => false
124
    t.boolean "is_filter",                     :default => false, :null => false
125
    t.integer "position",                      :default => 1
126
    t.boolean "searchable",                    :default => false
127
    t.text    "default_value"
128
  end
129

  
130
  create_table "custom_fields_projects", :id => false, :force => true do |t|
131
    t.integer "custom_field_id", :default => 0, :null => false
132
    t.integer "project_id",      :default => 0, :null => false
133
  end
134

  
135
  create_table "custom_fields_trackers", :id => false, :force => true do |t|
136
    t.integer "custom_field_id", :default => 0, :null => false
137
    t.integer "tracker_id",      :default => 0, :null => false
138
  end
139

  
140
  create_table "custom_values", :force => true do |t|
141
    t.string  "customized_type", :limit => 30, :default => "", :null => false
142
    t.integer "customized_id",                 :default => 0,  :null => false
143
    t.integer "custom_field_id",               :default => 0,  :null => false
144
    t.text    "value"
145
  end
146

  
147
  add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized"
148

  
149
  create_table "documents", :force => true do |t|
150
    t.integer  "project_id",                :default => 0,  :null => false
151
    t.integer  "category_id",               :default => 0,  :null => false
152
    t.string   "title",       :limit => 60, :default => "", :null => false
153
    t.text     "description"
154
    t.datetime "created_on"
155
  end
156

  
157
  add_index "documents", ["project_id"], :name => "documents_project_id"
158

  
159
  create_table "enabled_modules", :force => true do |t|
160
    t.integer "project_id"
161
    t.string  "name",       :null => false
162
  end
163

  
164
  add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id"
165

  
166
  create_table "enumerations", :force => true do |t|
167
    t.string  "opt",        :limit => 4,  :default => "",    :null => false
168
    t.string  "name",       :limit => 30, :default => "",    :null => false
169
    t.integer "position",                 :default => 1
170
    t.boolean "is_default",               :default => false, :null => false
171
  end
172

  
173
  create_table "issue_categories", :force => true do |t|
174
    t.integer "project_id",                   :default => 0,  :null => false
175
    t.string  "name",           :limit => 30, :default => "", :null => false
176
    t.integer "assigned_to_id"
177
  end
178

  
179
  add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id"
180

  
181
  create_table "issue_relations", :force => true do |t|
182
    t.integer "issue_from_id",                 :null => false
183
    t.integer "issue_to_id",                   :null => false
184
    t.string  "relation_type", :default => "", :null => false
185
    t.integer "delay"
186
  end
187

  
188
  create_table "issue_statuses", :force => true do |t|
189
    t.string  "name",       :limit => 30, :default => "",    :null => false
190
    t.boolean "is_closed",                :default => false, :null => false
191
    t.boolean "is_default",               :default => false, :null => false
192
    t.integer "position",                 :default => 1
193
  end
194

  
195
  create_table "issues", :force => true do |t|
196
    t.integer  "tracker_id",       :default => 0,  :null => false
197
    t.integer  "project_id",       :default => 0,  :null => false
198
    t.string   "subject",          :default => "", :null => false
199
    t.text     "description"
200
    t.date     "due_date"
201
    t.integer  "category_id"
202
    t.integer  "status_id",        :default => 0,  :null => false
203
    t.integer  "assigned_to_id"
204
    t.integer  "priority_id",      :default => 0,  :null => false
205
    t.integer  "fixed_version_id"
206
    t.integer  "author_id",        :default => 0,  :null => false
207
    t.integer  "lock_version",     :default => 0,  :null => false
208
    t.datetime "created_on"
209
    t.datetime "updated_on"
210
    t.date     "start_date"
211
    t.integer  "done_ratio",       :default => 0,  :null => false
212
    t.float    "estimated_hours"
213
  end
214

  
215
  add_index "issues", ["project_id"], :name => "issues_project_id"
216

  
217
  create_table "journal_details", :force => true do |t|
218
    t.integer "journal_id",               :default => 0,  :null => false
219
    t.string  "property",   :limit => 30, :default => "", :null => false
220
    t.string  "prop_key",   :limit => 30, :default => "", :null => false
221
    t.string  "old_value"
222
    t.string  "value"
223
  end
224

  
225
  add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
226

  
227
  create_table "journals", :force => true do |t|
228
    t.integer  "journalized_id",                 :default => 0,  :null => false
229
    t.string   "journalized_type", :limit => 30, :default => "", :null => false
230
    t.integer  "user_id",                        :default => 0,  :null => false
231
    t.text     "notes"
232
    t.datetime "created_on",                                     :null => false
233
  end
234

  
235
  add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id"
236

  
237
  create_table "members", :force => true do |t|
238
    t.integer  "user_id",           :default => 0,     :null => false
239
    t.integer  "project_id",        :default => 0,     :null => false
240
    t.integer  "role_id",           :default => 0,     :null => false
241
    t.datetime "created_on"
242
    t.boolean  "mail_notification", :default => false, :null => false
243
  end
244

  
245
  create_table "messages", :force => true do |t|
246
    t.integer  "board_id",                         :null => false
247
    t.integer  "parent_id"
248
    t.string   "subject",       :default => "",    :null => false
249
    t.text     "content"
250
    t.integer  "author_id"
251
    t.integer  "replies_count", :default => 0,     :null => false
252
    t.integer  "last_reply_id"
253
    t.datetime "created_on",                       :null => false
254
    t.datetime "updated_on",                       :null => false
255
    t.boolean  "locked",        :default => false
256
    t.integer  "sticky",        :default => 0
257
  end
258

  
259
  add_index "messages", ["parent_id"], :name => "messages_parent_id"
260
  add_index "messages", ["board_id"], :name => "messages_board_id"
261

  
262
  create_table "news", :force => true do |t|
263
    t.integer  "project_id"
264
    t.string   "title",          :limit => 60, :default => "", :null => false
265
    t.string   "summary",                      :default => ""
266
    t.text     "description"
267
    t.integer  "author_id",                    :default => 0,  :null => false
268
    t.datetime "created_on"
269
    t.integer  "comments_count",               :default => 0,  :null => false
270
  end
271

  
272
  add_index "news", ["project_id"], :name => "news_project_id"
273

  
274
  create_table "projects", :force => true do |t|
275
    t.string   "name",           :limit => 30,  :default => "",   :null => false
276
    t.text     "description",    :limit => 255
277
    t.string   "homepage",                      :default => ""
278
    t.boolean  "is_public",                     :default => true, :null => false
279
    t.integer  "parent_id"
280
    t.integer  "projects_count",                :default => 0
281
    t.datetime "created_on"
282
    t.datetime "updated_on"
283
    t.string   "identifier",     :limit => 20
284
    t.integer  "status",                        :default => 1,    :null => false
285
  end
286

  
287
  create_table "projects_trackers", :id => false, :force => true do |t|
288
    t.integer "project_id", :default => 0, :null => false
289
    t.integer "tracker_id", :default => 0, :null => false
290
  end
291

  
292
  add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id"
293

  
294
  create_table "queries", :force => true do |t|
295
    t.integer "project_id"
296
    t.string  "name",         :default => "",    :null => false
297
    t.text    "filters"
298
    t.integer "user_id",      :default => 0,     :null => false
299
    t.boolean "is_public",    :default => false, :null => false
300
    t.text    "column_names"
301
  end
302

  
303
  create_table "repositories", :force => true do |t|
304
    t.integer "project_id",               :default => 0,  :null => false
305
    t.string  "url",                      :default => "", :null => false
306
    t.string  "login",      :limit => 60, :default => ""
307
    t.string  "password",   :limit => 60, :default => ""
308
    t.string  "root_url",                 :default => ""
309
    t.string  "type"
310
  end
311

  
312
  create_table "roles", :force => true do |t|
313
    t.string  "name",        :limit => 30, :default => "",   :null => false
314
    t.integer "position",                  :default => 1
315
    t.boolean "assignable",                :default => true
316
    t.integer "builtin",                   :default => 0,    :null => false
317
    t.text    "permissions"
318
  end
319

  
320
  create_table "settings", :force => true do |t|
321
    t.string   "name",       :limit => 30, :default => "", :null => false
322
    t.text     "value"
323
    t.datetime "updated_on"
324
  end
325

  
326
  create_table "time_entries", :force => true do |t|
327
    t.integer  "project_id",  :null => false
328
    t.integer  "user_id",     :null => false
329
    t.integer  "issue_id"
330
    t.float    "hours",       :null => false
331
    t.string   "comments"
332
    t.integer  "activity_id", :null => false
333
    t.date     "spent_on",    :null => false
334
    t.integer  "tyear",       :null => false
335
    t.integer  "tmonth",      :null => false
336
    t.integer  "tweek",       :null => false
337
    t.datetime "created_on",  :null => false
338
    t.datetime "updated_on",  :null => false
339
  end
340

  
341
  add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id"
342
  add_index "time_entries", ["project_id"], :name => "time_entries_project_id"
343

  
344
  create_table "tokens", :force => true do |t|
345
    t.integer  "user_id",                  :default => 0,  :null => false
346
    t.string   "action",     :limit => 30, :default => "", :null => false
347
    t.string   "value",      :limit => 40, :default => "", :null => false
348
    t.datetime "created_on",                               :null => false
349
  end
350

  
351
  create_table "trackers", :force => true do |t|
352
    t.string  "name",          :limit => 30, :default => "",    :null => false
353
    t.boolean "is_in_chlog",                 :default => false, :null => false
354
    t.integer "position",                    :default => 1
355
    t.boolean "is_in_roadmap",               :default => true,  :null => false
356
  end
357

  
358
  create_table "user_preferences", :force => true do |t|
359
    t.integer "user_id",   :default => 0,     :null => false
360
    t.text    "others"
361
    t.boolean "hide_mail", :default => false
362
    t.string  "time_zone"
363
  end
364

  
365
  create_table "users", :force => true do |t|
366
    t.string   "login",             :limit => 30, :default => "",    :null => false
367
    t.string   "hashed_password",   :limit => 40, :default => "",    :null => false
368
    t.string   "firstname",         :limit => 30, :default => "",    :null => false
369
    t.string   "lastname",          :limit => 30, :default => "",    :null => false
370
    t.string   "mail",              :limit => 60, :default => "",    :null => false
371
    t.boolean  "mail_notification",               :default => true,  :null => false
372
    t.boolean  "admin",                           :default => false, :null => false
373
    t.integer  "status",                          :default => 1,     :null => false
374
    t.datetime "last_login_on"
375
    t.string   "language",          :limit => 5,  :default => ""
376
    t.integer  "auth_source_id"
377
    t.datetime "created_on"
378
    t.datetime "updated_on"
379
    t.string   "type"
380
  end
381

  
382
  create_table "versions", :force => true do |t|
383
    t.integer  "project_id",      :default => 0,  :null => false
384
    t.string   "name",            :default => "", :null => false
385
    t.string   "description",     :default => ""
386
    t.date     "effective_date"
387
    t.datetime "created_on"
388
    t.datetime "updated_on"
389
    t.string   "wiki_page_title"
390
  end
391

  
392
  add_index "versions", ["project_id"], :name => "altered_versions_project_id"
393

  
394
  create_table "watchers", :force => true do |t|
395
    t.string  "watchable_type", :default => "", :null => false
396
    t.integer "watchable_id",   :default => 0,  :null => false
397
    t.integer "user_id"
398
  end
399

  
400
  create_table "wiki_content_versions", :force => true do |t|
401
    t.integer  "wiki_content_id",                              :null => false
402
    t.integer  "page_id",                                      :null => false
403
    t.integer  "author_id"
404
    t.binary   "data"
405
    t.string   "compression",     :limit => 6, :default => ""
406
    t.string   "comments",                     :default => ""
407
    t.datetime "updated_on",                                   :null => false
408
    t.integer  "version",                                      :null => false
409
  end
410

  
411
  add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid"
412

  
413
  create_table "wiki_contents", :force => true do |t|
414
    t.integer  "page_id",                    :null => false
415
    t.integer  "author_id"
416
    t.text     "text"
417
    t.string   "comments",   :default => ""
418
    t.datetime "updated_on",                 :null => false
419
    t.integer  "version",                    :null => false
420
  end
421

  
422
  add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id"
423

  
424
  create_table "wiki_pages", :force => true do |t|
425
    t.integer  "wiki_id",                       :null => false
426
    t.string   "title",                         :null => false
427
    t.datetime "created_on",                    :null => false
428
    t.boolean  "protected",  :default => false, :null => false
429
  end
430

  
431
  add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title"
432

  
433
  create_table "wiki_redirects", :force => true do |t|
434
    t.integer  "wiki_id",      :null => false
435
    t.string   "title"
436
    t.string   "redirects_to"
437
    t.datetime "created_on",   :null => false
438
  end
439

  
440
  add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title"
441

  
442
  create_table "wikis", :force => true do |t|
443
    t.integer "project_id",                :null => false
444
    t.string  "start_page",                :null => false
445
    t.integer "status",     :default => 1, :null => false
446
  end
447

  
448
  add_index "wikis", ["project_id"], :name => "wikis_project_id"
449

  
450
  create_table "workflows", :force => true do |t|
451
    t.integer "tracker_id",    :default => 0, :null => false
452
    t.integer "old_status_id", :default => 0, :null => false
453
    t.integer "new_status_id", :default => 0, :null => false
454
    t.integer "role_id",       :default => 0, :null => false
455
  end
456

  
457
  add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status"
458

  
459
end
db/migrate/20080705072348_create_address_multi_values.rb (revision 0)
1
class CreateAddressMultiValues < ActiveRecord::Migration
2
  def self.up
3
    create_table :address_multi_values do |t|
4
      t.string :street
5
      t.string :city
6
      t.string :state
7
      t.string :postal_code
8
      t.string :country
9
      t.string :country_code
10
      t.string :phone_number
11
      t.string :url
12
      t.string :im_name
13
      t.string :im_service
14

  
15
      t.string :location
16

  
17
      t.integer :user_id
18
      t.string :type
19
      
20
      t.timestamps
21
    end
22
  end
23

  
24
  def self.down
25
    drop_table :address_multi_values
26
  end
27
end
    (1-1/1)