Closed eskuai closed 10 years ago
There generally isn't an "easy" way to do this, and table collisions are sadly a common issue with Redmine plugins.
You could try the following for now though:
db/migrate/20100317201659_add_ratings_to_articles.rb
class AddRatingsToArticles < ActiveRecord::Migration
require 'acts_as_rated'
def self.up
# change this entry
ActiveRecord::Base.create_ratings_table :table_name => "kb_ratings", :with_rater => false
end
def self.down
# change this entry
ActiveRecord::Base.drop_ratings_table :table_name => "kb_ratings"
end
end
class KbArticle < ActiveRecord::Base
unloadable
# ...
# update this entry
acts_as_rated :rating_class => "KbRating", :no_rater => true
#...
end
This is completely untested and i'm doing this from memory, but it might work ...
Thank you Tested and it works perfect ... i got not problems trying to install redmine_re ...
Hello,
When I am trying to install and i got the following error :+1:
---- begin copy & paste --- AddRedmineUserAsResponsibleToArtifactProperties: migrating ============== -- add_column(:re_artifact_properties, "responsible_id", :integer)
Mysql2::Error: Table 'ratings' already exists: CREATE TABLE
ratings
(id
int(11) DEFAULT NULL auto_increment PRIMARY KEY,user_id
varchar(255),re_artifact_properties_id
varchar(255),value
int(11)) ENGINE=InnoDB/usr/local/rvm/gems/ruby-1.9.3-p545/gems/activerecord-3.2.17/lib/active_record/connection_adapt ers/abstract_mysql_adapter.rb:245:inquery' /usr/local/rvm/gems/ruby-1.9.3-p545/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in
block in execute' /usr/local/rvm/gems/ruby-1.9.3-p545/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract_adapter.rb:280:inblock in log' /usr/local/rvm/gems/ruby-1.9.3-p545/gems/activesupport-3.2.17/lib/active_support/notifications/instrumenter.rb:20:in
instrument' /usr/local/rvm/gems/ruby-1.9.3-p545/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract_adapter.rb:275:inlog' /usr/local/rvm/gems/ruby-1.9.3-p545/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in
execute' /usr/local/rvm/gems/ruby-1.9.3-p545/gems/activerecord-3.2.17/lib/active_record/connection_adapters/mysql2_adapter.rb:213:inexecute' /usr/local/rvm/gems/ruby-1.9.3-p545/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract/schema_statements.rb:170:in
create_table' /usr/local/rvm/gems/ruby-1.9.3-p545/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:434:increate_table' /usr/local/rvm/gems/ruby-1.9.3-p545/gems/activerecord-3.2.17/lib/active_record/migration.rb:466:in
block in method_missing' /usr/local/rvm/gems/ruby-1.9.3-p545/gems/activerecord-3.2.17/lib/active_record/migration.rb:438:inblock in say_with_time' /usr/local/rvm/gems/ruby-1.9.3-p545/gems/activerecord-3.2.17/lib/active_record/migration.rb:438:in
say_with_time' ---- end copy & paste ---What is happen?
Ok, two tables are using same name ... but differents plugins ... redmine-re and knowledgebase plugins are in conflict...
Because, if i do ...
root@darkstar:/var/www/redmine/plugins# find . -name "*.rb" | xargs grep -i "ratings"
shows ./redmine_knowledgebase/lib/acts_as_rated.rb got a table "rating".
Is there a "easy way" to change the name of the table "ratings" , and change it to "kratings" ... for exam,ple
How can i change "sql" creating process, and the rb files to create and use this table with another name?
Any way to do this? avoid tables name from differents plugins conflict?
Thank you