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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix migration and model for ProjectStorage
Wieland Lindenthalcf99edc7f02e
diff --git a/db/migrate/20220113144759_create_file_links.rb b/db/migrate/20220113144759_create_file_links.rbindex 8156bca45f9..8f81e7c29a5 100644--- a/db/migrate/20220113144759_create_file_links.rb+++ b/db/migrate/20220113144759_create_file_links.rb@@ -20,9 +20,9 @@ class CreateFileLinks < ActiveRecord::Migration[6.1]t.timestamps# i.e. show all file links per WP.- t.index [:container_id, :container_type]+ t.index %i[container_id container_type]# i.e. show all work packages per file.- t.index [:origin_id, :storage_id]+ t.index %i[origin_id storage_id]endendenddiff --git a/db/migrate/20220121090847_create_projects_storages.rb b/db/migrate/20220121090847_create_projects_storages.rbindex 35a2705645a..72f57b393e2 100644--- a/db/migrate/20220121090847_create_projects_storages.rb+++ b/db/migrate/20220121090847_create_projects_storages.rb@@ -1,14 +1,15 @@class CreateProjectsStorages < ActiveRecord::Migration[6.1]def changecreate_table :projects_storages do |t|- t.bigint :project_id, null: false, foreign_key: true- t.bigint :storage_id, null: false, foreign_key: true- t.bigint :creator_id, null: false, foreign_key: true+ t.references :project, null: false, foreign_key: true, on_delete: :cascade+ t.references :storage, null: false, foreign_key: true, on_delete: :cascade+ t.references :creator,+ null: false,+ index: true,+ foreign_key: { to_table: :users }t.timestamps- t.index :project_id- t.index :storage_idt.index %i[project_id storage_id], unique: trueendenddiff --git a/modules/storages/app/controllers/storages/admin/projects_storages_controller.rb b/modules/storages/app/controllers/storages/admin/projects_storages_controller.rbindex 3e7eec6571a..4869a1e4f13 100644--- a/modules/storages/app/controllers/storages/admin/projects_storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/projects_storages_controller.rb@@ -2,7 +2,7 @@#-- copyright# OpenProject is an open source project management software.-# Copyright (C) 2012-2021 the OpenProject GmbH+# Copyright (C) 2012-2022 the OpenProject GmbH## This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License version 3.diff --git a/modules/storages/app/models/storages/project_storage.rb b/modules/storages/app/models/storages/project_storage.rbindex 3e7fe17f319..2d32d410db9 100644--- a/modules/storages/app/models/storages/project_storage.rb+++ b/modules/storages/app/models/storages/project_storage.rb@@ -2,7 +2,7 @@#-- copyright# OpenProject is an open source project management software.-# Copyright (C) 2012-2021 the OpenProject GmbH+# Copyright (C) 2012-2022 the OpenProject GmbH## This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License version 3.@@ -30,7 +30,7 @@class Storages::ProjectStorage < ApplicationRecordself.table_name = 'projects_storages'- belongs_to :project, class_name: 'Project'+ belongs_to :projectbelongs_to :storage, class_name: 'Storages::Storage'belongs_to :creator, class_name: 'User'