Permalink
Browse files

Rename deployments DB column to description in order to prevent Oracl…

…e crash, fix #17

git-svn-id: svn+ssh://phoenix/srv/svn/webistrano/trunk@42 e1153f85-6c6c-dc11-afa8-0013d3c39b19
  • Loading branch information...
1 parent 9c1691d commit b170a504dc7121ca849963ff710a97cbcb44cf4f jweiss committed Nov 26, 2007
View
2 CHANGELOG.txt
@@ -1,5 +1,7 @@
* SVN *
+* Rename deployments DB column to description in order to prevent Oracle crash, fix #17
+
* Delete the cached stylesheet on server boot
* A stage can list all available tasks [schacon@gmail.com]
View
4 app/models/deployment.rb
@@ -3,11 +3,11 @@ class Deployment < ActiveRecord::Base
belongs_to :user
has_and_belongs_to_many :roles
- validates_presence_of :task, :stage, :comment, :user
+ validates_presence_of :task, :stage, :description, :user
validates_length_of :task, :maximum => 250
validates_inclusion_of :success, :in => 0..1
- attr_accessible :task, :prompt_config, :comment
+ attr_accessible :task, :prompt_config, :description
# given configuration hash on create in order to satisfy prompt configurations
attr_accessor :prompt_config
View
2 app/views/deployments/_status.rhtml
@@ -52,7 +52,7 @@
<fieldset class="fieldset">
<legend>Comment</legend>
- <%=web_friendly_text @deployment.comment %>
+ <%=web_friendly_text @deployment.description %>
</fieldset>
<br /> <br />
View
2 app/views/deployments/index.rhtml
@@ -23,7 +23,7 @@
<tr class="<%= cycle :even, :odd, :name => 'deployments' %>">
<td><%= link_to h(deployment.task), project_stage_deployment_path(current_project, current_stage, deployment) %></td>
<td><%=h deployment.created_at.to_s(:log) %><br /><%=h deployment.completed_at.to_s(:log) rescue '&nbsp;' %></td>
- <td><%=h truncate(deployment.comment, 37) %></td>
+ <td><%=h truncate(deployment.description, 37) %></td>
<td><%= user_info(deployment.user) rescue '' %></td>
<td><%= image_tag('peritor_theme/'+deployment.status_image)%></td>
</tr>
View
2 app/views/deployments/new.rhtml
@@ -10,7 +10,7 @@
<p>
<b>Comment</b><br />
- <%= f.text_area :comment, :style => 'width:410px;height:65px;' %>
+ <%= f.text_area :description, :style => 'width:410px;height:65px;' %>
</p>
<% unless @stage.prompt_configurations.empty? %>
View
2 app/views/notification/deployment.rhtml
@@ -13,7 +13,7 @@ Deployed by: <%= @deployment.user.login %>
Comment:
-<%= @deployment.comment %>
+<%= @deployment.description %>
Log:
View
2 app/views/stages/_deployments.rhtml
@@ -15,7 +15,7 @@
<tr class="<%= cycle :even, :odd, :name => 'deployments' %>">
<td><%= link_to h(deployment.task), project_stage_deployment_path(current_project, @stage, deployment) %></td>
<td nowrap><%=h deployment.created_at.to_s(:log) %><br /><%=h deployment.completed_at.to_s(:log) rescue '&nbsp;' %></td>
- <td><%=h truncate(deployment.comment, 37) %></td>
+ <td><%=h truncate(deployment.description, 37) %></td>
<td><%= user_info(deployment.user) rescue '' %></td>
<td style="padding:3px 0px 0px 0px;" valign="middle" align="center"><%= image_tag('peritor_theme/'+deployment.status_image)%></td>
<td>
View
2 app/views/users/_deployments.rhtml
@@ -19,7 +19,7 @@
</td>
<td><%= link_to h(deployment.task), project_stage_deployment_path(deployment.stage.project, deployment.stage, deployment) %></td>
<td ><%=h deployment.created_at.to_s(:log) %><br /><%=h deployment.completed_at.to_s(:log) rescue '&nbsp;' %></td>
- <td><%=h truncate(deployment.comment, 37) %></td>
+ <td><%=h truncate(deployment.description, 37) %></td>
<td style="padding:3px 0px 0px 0px;" valign="middle" align="center"><%= image_tag('peritor_theme/'+deployment.status_image)%></td>
<td>
<% if deployment.completed? %>
View
9 db/migrate/021_rename_comment_to_description.rb
@@ -0,0 +1,9 @@
+class RenameCommentToDescription < ActiveRecord::Migration
+ def self.up
+ rename_column :deployments, :comment, :description
+ end
+
+ def self.down
+ rename_column :deployments, :description, :comment
+ end
+end
View
4 db/schema.rb
@@ -2,7 +2,7 @@
# migrations feature of ActiveRecord to incrementally modify your database, and
# then regenerate this schema definition.
-ActiveRecord::Schema.define(:version => 20) do
+ActiveRecord::Schema.define(:version => 21) do
create_table "configuration_parameters", :force => true do |t|
t.string "name"
@@ -23,7 +23,7 @@
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "completed_at"
- t.text "comment"
+ t.text "description"
t.integer "user_id"
end
View
8 test/functional/deployments_controller_test.rb
@@ -38,7 +38,7 @@ def test_should_create_deployment_if_deployment_possbile
Deployment.delete_all
assert @stage.deployment_possible?
- post :create, :deployment => { :task => 'deploy:default', :comment => 'update to newest' }, :project_id => @project.id, :stage_id => @stage.id
+ post :create, :deployment => { :task => 'deploy:default', :description => 'update to newest' }, :project_id => @project.id, :stage_id => @stage.id
assert_equal 1, Deployment.count
assert_equal @user, Deployment.find(:all).last.user
@@ -50,7 +50,7 @@ def test_should_not_create_deployment_if_deployment_not_possbile
assert !@stage.deployment_possible?
old_count = Deployment.count
- post :create, :deployment => { :task => 'deploy:default', :comment => 'update to newest' }, :project_id => @project.id, :stage_id => @stage.id
+ post :create, :deployment => { :task => 'deploy:default', :description => 'update to newest' }, :project_id => @project.id, :stage_id => @stage.id
assert_equal old_count, Deployment.count
assert_redirected_to project_stage_path(@project, @stage)
@@ -83,12 +83,12 @@ def test_prompt_before_deploy
assert_match /password/, @response.body
# test that we need to enter this parameters
- post :create, :deployment => { :task => 'deploy:default', :comment => 'update to newest', :prompt_config => {} }, :project_id => @project.id, :stage_id => @stage.id
+ post :create, :deployment => { :task => 'deploy:default', :description => 'update to newest', :prompt_config => {} }, :project_id => @project.id, :stage_id => @stage.id
assert_response :success
assert_equal 0, Deployment.count
# now give the missing config
- post :create, :deployment => { :task => 'deploy:default', :comment => 'update to newest', :prompt_config => {:password => 'abc'} }, :project_id => @project.id, :stage_id => @stage.id
+ post :create, :deployment => { :task => 'deploy:default', :description => 'update to newest', :prompt_config => {:password => 'abc'} }, :project_id => @project.id, :stage_id => @stage.id
assert_response :redirect
assert_equal 1, Deployment.count
end
View
4 test/test_helper.rb
@@ -172,7 +172,7 @@ def create_new_deployment(options = {})
:success => 0,
:prompt_config => {},
:roles => [],
- :comment => random_string,
+ :description => random_string,
:user => create_new_user
}.update(options)
@@ -182,7 +182,7 @@ def create_new_deployment(options = {})
d.completed_at = options[:completed_at]
d.success = options[:success]
d.prompt_config = options[:prompt_config]
- d.comment = options[:comment]
+ d.description = options[:description]
d.user = options[:user]
d.roles << options[:roles] unless options[:roles].empty?
View
20 test/unit/deployment_test.rb
@@ -7,7 +7,7 @@ def setup
@role_app = create_new_role(:name => 'app', :stage => @stage)
@role_www = create_new_role(:name => 'app', :stage => @stage)
- @deployment = create_new_deployment(:stage => @stage, :roles => [@role_app, @role_www], :comment => 'update code to newest')
+ @deployment = create_new_deployment(:stage => @stage, :roles => [@role_app, @role_www], :description => 'update code to newest')
end
def test_creation
@@ -18,7 +18,7 @@ def test_creation
assert_nothing_raised{
d = Deployment.new(:task => 'deploy:setup')
d.stage = @stage
- d.comment = "Update to newest version"
+ d.description = "Update to newest version"
d.user = create_new_user
d.save!
}
@@ -39,33 +39,33 @@ def test_validation
assert !d.valid?
assert_not_nil d.errors.on('task')
assert_not_nil d.errors.on('stage')
- assert_not_nil d.errors.on('comment')
+ assert_not_nil d.errors.on('description')
assert_not_nil d.errors.on('user')
# fix it
d.stage = @stage
assert !d.valid?
assert_not_nil d.errors.on('user')
- assert_not_nil d.errors.on('comment')
+ assert_not_nil d.errors.on('description')
assert_not_nil d.errors.on('task')
assert_nil d.errors.on('stage')
d.task = 'deploy:setup'
assert !d.valid?
assert_not_nil d.errors.on('user')
- assert_not_nil d.errors.on('comment')
+ assert_not_nil d.errors.on('description')
assert_nil d.errors.on('task')
assert_nil d.errors.on('stage')
- d.comment = 'update to newest'
+ d.description = 'update to newest'
assert !d.valid?
assert_not_nil d.errors.on('user')
- assert_nil d.errors.on('comment')
+ assert_nil d.errors.on('description')
assert_nil d.errors.on('task')
assert_nil d.errors.on('stage')
d.user = create_new_user
assert d.valid?
assert_nil d.errors.on('user')
- assert_nil d.errors.on('comment')
+ assert_nil d.errors.on('description')
assert_nil d.errors.on('task')
assert_nil d.errors.on('stage')
@@ -121,7 +121,7 @@ def test_validation_depends_on_stage_ready_to_deploy
deployment = Deployment.new(:task => 'shell')
deployment.stage = stage
- deployment.comment = 'comment'
+ deployment.description = 'description'
deployment.user = create_new_user
deployment.roles << role
@@ -151,7 +151,7 @@ def test_check_of_stage_prompt_configuration_in_validation
deployment = Deployment.new
deployment.stage = @stage
deployment.task = 'deploy'
- deployment.comment = 'bugfix'
+ deployment.description = 'bugfix'
deployment.user = create_new_user
deployment.roles << @stage.roles

0 comments on commit b170a50

Please sign in to comment.