Forums » Development »
Automatic Project Creation
Added by Antonio Marcolino about 13 years ago
I need to create a script to make the creation of 300 projects in Redmine, I am struggling to handle the DataBase (MySQL) Table projects and their fields "lft" "RGT" I'm not getting to understand their behavior.
I created a sql query to insert the projects of my desire but the automatic creation was unsuccessful because the fields LFT & RGT.
So I would like to help the personal development of Redmine so I can create such a script.
Replies (5)
RE: Automatic Project Creation - Added by Etienne Massip about 13 years ago
lft
, rgt
, root_id
and parent_id
are columns used by the awesome_nested_set
vendored with Redmine; in the case of the projects
table they are needed to handle project hierarchy.
If your script is written in Ruby language then you should use RoR ActiveRecord API as much as you can rather than writing your own SQL queries; thus a simple p = Project.new( :name => 'my project'); p.save!
(or something close) will create a new Project object and persist it in DB.
RE: Automatic Project Creation - Added by Tony Marschall about 13 years ago
Maybe you can also use REST API Rest_Projects
RE: Automatic Project Creation - Added by Antonio Marcolino about 13 years ago
Tks Guys
researched solutions and would like some of you on a opnião I found for this problem.
follows:
http://redmineblog.com/articles/redmine-client-access-the-redmine-api-in-ruby/
Using the same parameters and I'm getting errors.
Redmine Client - Access the Redmine API in Ruby
require 'rubygems'
require 'redmine_client'
require 'active_resource'
RedmineClient::Base.configure do
self.site = 'http://MY_redmineqa'
self.user = 'admin'
self.password = 'admin'
end
issue = RedmineClient::Issue.find(1018)
issue.subject = "Changed via the API TESTE"
issue.save
eRROR:
/var/lib/gems/1.8/gems/activesupport-2.3.11/lib/active_support/vendor.rb:32: warning: redefine normalize_translation_keys
/usr/lib/ruby/1.8/pathname.rb:263: warning: `*' interpreted as argument prefix
/var/lib/gems/1.8/gems/redmine_client-0.0.1/lib/redmine_client/base.rb:5: warning: `&' interpreted as argument prefix
/var/lib/gems/1.8/gems/activeresource-2.3.11/lib/active_resource/connection.rb:219: warning: instance variable @proxy not initialized
/var/lib/gems/1.8/gems/activeresource-2.3.11/lib/active_resource/connection.rb:230: warning: instance variable @timeout not initialized
/var/lib/gems/1.8/gems/activeresource-2.3.11/lib/active_resource/connection.rb:190:in `handle_response': Failed with 401 Authorization Required (ActiveResource::UnauthorizedAccess)
from /var/lib/gems/1.8/gems/activeresource-2.3.11/lib/active_resource/connection.rb:173:in `request'
from /var/lib/gems/1.8/gems/activeresource-2.3.11/lib/active_resource/connection.rb:138:in `get'
from /var/lib/gems/1.8/gems/activeresource-2.3.11/lib/active_resource/base.rb:661:in `find_single'
from /var/lib/gems/1.8/gems/activeresource-2.3.11/lib/active_resource/base.rb:589:in `find'
from teste.rb:15
RE: Automatic Project Creation - Added by Antonio Marcolino about 13 years ago
Hy. Tks
I managed to make the creation of projects using the API as was explained to me.
Thank you very much
RE: Automatic Project Creation - Added by Antonio Marcolino about 13 years ago
Hy. Tks
I managed to make the creation of projects using the API as was explained to me.
Thank you very much