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

Creates necessary table for journaling

Marcello Rocha158e168e7a77
diff --git a/app/models/journal/storable_journal.rb b/app/models/journal/storable_journal.rb
new file mode 100644
index 00000000000..8731ccabbe6
--- /dev/null
+++ b/app/models/journal/storable_journal.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 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.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+class Journal::StorableJournal < Journal::AssociatedJournal
+ self.table_name = 'storages_file_links_journals'
+
+ belongs_to :file_link, class_name: 'Storages::FileLink'
+end
diff --git a/db/migrate/20230713144232_create_storages_file_link_journals.rb b/db/migrate/20230713144232_create_storages_file_link_journals.rb
new file mode 100644
index 00000000000..ca1dce77fe8
--- /dev/null
+++ b/db/migrate/20230713144232_create_storages_file_link_journals.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 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.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+class CreateStoragesFileLinkJournals < ActiveRecord::Migration[7.0]
+ def change
+ # rubocop:disable Rails/CreateTableWithTimestamps
+ create_table :storages_file_links_journals do |t|
+ t.belongs_to :journal
+ t.belongs_to :file_link
+
+ t.string :link_name, default: ''
+ end
+ # rubocop:enable Rails/CreateTableWithTimestamps
+ end
+end
diff --git a/modules/storages/app/models/storages/file_link.rb b/modules/storages/app/models/storages/file_link.rb
index 383630d686b..07d1210a17c 100644
--- a/modules/storages/app/models/storages/file_link.rb
+++ b/modules/storages/app/models/storages/file_link.rb
@@ -45,7 +45,7 @@ class Storages::FileLink < ApplicationRecord
# The object who created the FileLink should be of type User.
belongs_to :creator, class_name: 'User'
- # FileLinks are attached to a container ()currently a WorkPackage)
+ # FileLinks are attached to a container (currently a WorkPackage)
# Wieland: This needs to become more flexible in the future
belongs_to :container, polymorphic: true