Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Enable the Gantt module for freshly seeded and exisiting instances for all projects

Henriette Dargec2453ef2db91
diff --git a/app/seeders/standard.yml b/app/seeders/standard.yml
index 62d028f7919..8eee51f1803 100644
--- a/app/seeders/standard.yml
+++ b/app/seeders/standard.yml
@@ -263,6 +263,7 @@ projects:
modules:
- work_package_tracking
- news
+ - gantt
- wiki
- board_view
- team_planner_view
@@ -544,6 +545,7 @@ projects:
- news
- wiki
- work_package_tracking
+ - gantt
- board_view
news:
- t_title: Welcome to your Scrum demo project
diff --git a/db/migrate/20240131130149_enable_gantt_module_for_all_projects.rb b/db/migrate/20240131130149_enable_gantt_module_for_all_projects.rb
new file mode 100644
index 00000000000..ef5951220d6
--- /dev/null
+++ b/db/migrate/20240131130149_enable_gantt_module_for_all_projects.rb
@@ -0,0 +1,19 @@
+require_relative 'migration_utils/utils'
+
+class EnableGanttModuleForAllProjects < ActiveRecord::Migration[7.0]
+ include ::Migration::Utils
+
+ def up
+ execute_sql "
+ INSERT INTO enabled_modules (project_id, name)
+ SELECT id, 'gantt' FROM projects
+ WHERE id NOT IN (SELECT project_id FROM enabled_modules WHERE name = 'gantt')
+ AND id IN (SELECT project_id FROM enabled_modules WHERE name = 'work_package_tracking')
+ AND active;
+ "
+ end
+
+ def down
+ execute_sql "DELETE FROM enabled_modules WHERE name = 'gantt'"
+ end
+end
diff --git a/modules/bim/app/seeders/bim.yml b/modules/bim/app/seeders/bim.yml
index 26ccb2d54e6..180218c5fc2 100644
--- a/modules/bim/app/seeders/bim.yml
+++ b/modules/bim/app/seeders/bim.yml
@@ -234,6 +234,7 @@ projects:
t_description: This is a short summary of the goals of this demo construction project.
modules:
- work_package_tracking
+ - gantt
- news
- wiki
- board_view
@@ -380,6 +381,7 @@ projects:
t_description: This is a short summary of the goals of this demo planning and constructing project.
modules:
- work_package_tracking
+ - gantt
- news
- wiki
- board_view
@@ -846,6 +848,7 @@ projects:
t_description: This is a short summary of the goals of this demo BIM project.
modules:
- work_package_tracking
+ - gantt
- news
- wiki
- board_view
@@ -1428,6 +1431,7 @@ projects:
t_description: This is a short summary of the goals of this demo BCF management project.
modules:
- work_package_tracking
+ - gantt
- bim
- board_view
- team_planner_view
diff --git a/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb b/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb
index 70d70abfeb3..981c75a1594 100644
--- a/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb
+++ b/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb
@@ -33,7 +33,8 @@ RSpec::Matchers.define_negated_matcher :not_start_with, :start_with
RSpec.describe RootSeeder,
'BIM edition',
- with_config: { edition: 'bim' } do
+ with_config: { edition: 'bim' },
+ with_flag: { show_separate_gantt_module: true } do
include RootSeederTestHelpers
shared_examples 'creates BIM demo data' do
@@ -47,6 +48,7 @@ RSpec.describe RootSeeder,
it 'creates the BIM demo data' do
expect(Project.count).to eq 4
+ expect(EnabledModule.count).to eq 23
expect(WorkPackage.count).to eq 76
expect(Wiki.count).to eq 3
expect(Query.count).to eq 29
diff --git a/spec/seeders/root_seeder_standard_edition_spec.rb b/spec/seeders/root_seeder_standard_edition_spec.rb
index 7636fb52257..ba4e15d4ac4 100644
--- a/spec/seeders/root_seeder_standard_edition_spec.rb
+++ b/spec/seeders/root_seeder_standard_edition_spec.rb
@@ -33,7 +33,8 @@ require_relative 'root_seeder_shared_examples'
RSpec.describe RootSeeder,
'standard edition',
- with_config: { edition: 'standard' } do
+ with_config: { edition: 'standard' },
+ with_flag: { show_separate_gantt_module: true } do
include RootSeederTestHelpers
shared_examples 'creates standard demo data' do
@@ -47,6 +48,7 @@ RSpec.describe RootSeeder,
it 'creates the demo data' do
expect(Project.count).to eq 2
+ expect(EnabledModule.count).to eq 13
expect(WorkPackage.count).to eq 36
expect(Wiki.count).to eq 2
expect(Query.having_views.count).to eq 8