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

Update Seeder and Seed Data with new table structure

Aaron Contreras8968c1b66193
diff --git a/app/seeders/demo_data/project_seeder.rb b/app/seeders/demo_data/project_seeder.rb
index 4cd0ab7b941..d451f90ac51 100644
--- a/app/seeders/demo_data/project_seeder.rb
+++ b/app/seeders/demo_data/project_seeder.rb
@@ -35,7 +35,6 @@ module DemoData
print_status " ↳ Creating project: #{project_data.lookup('name')}"
self.project = reset_project
- set_project_status
set_members
seed_news
set_types
@@ -73,21 +72,6 @@ module DemoData
Project.create! project_attributes
end
- def set_project_status
- print_status ' -Setting project status.'
-
- status_code = project_data.lookup('status.code')
- status_explanation = project_data.lookup('status.description')
-
- if status_code || status_explanation
- Projects::Status.create!(
- project:,
- code: status_code,
- explanation: status_explanation
- )
- end
- end
-
def set_members
print_status ' -Setting members.'
@@ -160,6 +144,8 @@ module DemoData
{
name: project_data.lookup('name'),
identifier: project_data.lookup('identifier'),
+ status_code: project_data.lookup('status_code'),
+ status_explanation: project_data.lookup('status_explanation'),
description: project_data.lookup('description'),
enabled_module_names: project_data.lookup('modules'),
types: Type.all,
diff --git a/app/seeders/standard.yml b/app/seeders/standard.yml
index 351d435cf82..9050dec29d0 100644
--- a/app/seeders/standard.yml
+++ b/app/seeders/standard.yml
@@ -43,9 +43,8 @@ projects:
demo-project:
t_name: Demo project
identifier: demo-project
- status:
- code: on_track
- t_description: All tasks are on schedule. The people involved know their tasks. The system is completely set up.
+ status_code: on_track
+ t_status_explanation: All tasks are on schedule. The people involved know their tasks. The system is completely set up.
t_description: This is a short summary of the goals of this demo project.
modules:
- work_package_tracking
@@ -322,9 +321,8 @@ projects:
scrum-project:
t_name: Scrum project
identifier: your-scrum-project
- status:
- code: on_track
- t_description: All tasks are on schedule. The people involved know their tasks. The system is completely set up.
+ status_code: on_track
+ t_status_explanation: All tasks are on schedule. The people involved know their tasks. The system is completely set up.
t_description: This is a short summary of the goals of this demo Scrum project.
modules:
- backlogs
diff --git a/config/locales/en.seeders.standard.yml.example b/config/locales/en.seeders.standard.yml.example
index f9874ff0de3..cf27bb5bb0b 100644
--- a/config/locales/en.seeders.standard.yml.example
+++ b/config/locales/en.seeders.standard.yml.example
@@ -55,9 +55,8 @@ en:
demo-project:
name: Demo project
identifier: demo-project
- status:
- code: off_track
- description: Everything is behind the deadline. We will never make it.
+ status_code: off_track
+ status_explanation: Everything is behind the deadline. We will never make it.
description: >
**This is a demo project**. You can edit the description in
the [Project settings -> Description]({{opSetting:base_url}}/projects/demo-project/settings).
diff --git a/modules/bim/app/seeders/bim.yml b/modules/bim/app/seeders/bim.yml
index 88c6224390d..798463ad5a7 100644
--- a/modules/bim/app/seeders/bim.yml
+++ b/modules/bim/app/seeders/bim.yml
@@ -81,10 +81,11 @@ projects:
demo-construction-project:
t_name: (Demo) Construction project
identifier: demo-construction-project
- status:
- code: on_track
- t_description: All tasks and the sub-projects are on schedule. The people involved know their tasks. The system is completely set up.
+ status_code: on_track
+ t_status_explanation: All tasks and the sub-projects are on schedule. The people involved know their tasks. The system is completely set up.
t_description: This is a short summary of the goals of this demo construction project.
+ timeline:
+ name: Timeline
modules:
- work_package_tracking
- news
@@ -227,9 +228,8 @@ projects:
demo-planning-constructing-project:
t_name: (Demo) Planning & constructing
identifier: demo-planning-constructing-project
- status:
- code: on_track
- t_description: All tasks are on schedule. The people involved know their tasks. The system is completely set up.
+ status_code: on_track
+ t_status_explanation: All tasks are on schedule. The people involved know their tasks. The system is completely set up.
parent: demo-construction-project
t_description: This is a short summary of the goals of this demo planning and constructing project.
modules:
@@ -694,9 +694,8 @@ projects:
demo-bim-project:
t_name: (Demo) BIM project
identifier: demo-bim-project
- status:
- code: on_track
- t_description: All tasks and sub-projects are on schedule. The people involved know their tasks. The system is completely set up.
+ status_code: on_track
+ t_status_explanation: All tasks and sub-projects are on schedule. The people involved know their tasks. The system is completely set up.
parent: demo-construction-project
t_description: This is a short summary of the goals of this demo BIM project.
modules:
@@ -1277,9 +1276,8 @@ projects:
demo-bcf-management-project:
t_name: (Demo) BCF management
identifier: demo-bcf-management-project
- status:
- code: on_track
- t_description: All tasks are on schedule. The people involved know their tasks. The system is completely set up.
+ status_code: on_track
+ t_status_explanation: All tasks are on schedule. The people involved know their tasks. The system is completely set up.
parent: demo-bim-project
t_description: This is a short summary of the goals of this demo BCF management project.
modules:
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 1e21a31e829..1b9dac6cc6f 100644
--- a/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb
+++ b/modules/bim/spec/seeders/root_seeder_bim_edition_spec.rb
@@ -50,7 +50,6 @@ describe RootSeeder,
expect(Type.count).to eq 7
expect(Status.count).to eq 4
expect(IssuePriority.count).to eq 4
- expect(Projects::Status.count).to eq 4
expect(Bim::IfcModels::IfcModel.count).to eq 3
expect(Grids::Overview.count).to eq 4
expect(Boards::Grid.count).to eq 2
diff --git a/spec/seeders/root_seeder_standard_edition_spec.rb b/spec/seeders/root_seeder_standard_edition_spec.rb
index fe212918ce2..79aa92f36cf 100644
--- a/spec/seeders/root_seeder_standard_edition_spec.rb
+++ b/spec/seeders/root_seeder_standard_edition_spec.rb
@@ -51,7 +51,6 @@ describe RootSeeder,
expect(View.where(type: 'work_packages_table').count).to eq 7
expect(View.where(type: 'team_planner').count).to eq 1
expect(Query.count).to eq 26
- expect(Projects::Status.count).to eq 2
expect(Role.where(type: 'Role').count).to eq 5
expect(GlobalRole.count).to eq 1
expect(Grids::Overview.count).to eq 2
@@ -104,7 +103,6 @@ describe RootSeeder,
expect(View.where(type: 'work_packages_table').count).to eq 7
expect(View.where(type: 'team_planner').count).to eq 1
expect(Query.count).to eq 26
- expect(Projects::Status.count).to eq 2
expect(Role.where(type: 'Role').count).to eq 5
expect(GlobalRole.count).to eq 1
expect(Grids::Overview.count).to eq 2