Allen Hancock
Allen Hancock

Reputation: 579

I've added a module in redmine, how can I enable it for many projects at once?

I've got all these great new plugins enabled, and I can enable them on any given project.

However, I don't see a way to add/remove them from many projects at once.

Perhaps I need a module management plugin? ;-)

Upvotes: 6

Views: 1703

Answers (4)

azerttyu
azerttyu

Reputation: 11

I've faced to this issue earlier, to be more precise, I propose this query to update only project unset :

SET @module="Module Name" COLLATE utf8mb4_unicode_ci; INSERT INTO `enabled_modules` (`project_id`, `name`) SELECT p.id, @module FROM projects p LEFT JOIN enabled_modules m ON p.id=m.project_id AND m.name=@module WHERE m.id IS NULL;

COLLATE is not required. Could be used when an error occurs about mix collation error.

And better solution is to use this rails command :

Project.all.each { |p| p.enable_module!(:module_name) }

Upvotes: 0

In my case Redmine 3.1.0 and MySQL is used as DB server. I think, you'll get the main idea in case of other confuguration.

DELETE FROM `enabled_modules` WHERE `name` = 'module_name_here';
INSERT INTO `enabled_modules` 
    (`project_id`, `name`) 
SELECT 
    `id`, 'module_name_here' 
FROM 
    `projects`

You can activate module for one project to discover its name from enabled_modules. Or you can find it in plugin sources, it should look like 'project_module :module_name_here'

Please, don't do this if you do not completely understand, what is this answer about!

PS: Yes, I know - it is a dirty solution, but it's fast and easy enough for operation which is neccesary once a year or less.

Upvotes: 2

Flogo
Flogo

Reputation: 1878

It's been a while and I reckon the OP has since solved his problem. In case someone else has the same problem:

We also had to activate a few modules in all projects and wrote a small script to do it for us: https://github.com/EugenMayer/enable_chiliproject_modules

Edit: This was created and tested for the Redmine fork "Chiliproject" but should work without changes in Redmine.

Upvotes: 2

marapet
marapet

Reputation: 56566

how can I enable it many projects at once?

You can't - at least not by using the UI.

Upvotes: 0

Related Questions