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

Fix migration and model for storages

Wieland Lindenthal48e9b12a1561
diff --git a/db/migrate/20220113144323_create_storage.rb b/db/migrate/20220113144323_create_storage.rb
index edffc7fa7ca..4b3223da2ba 100644
--- a/db/migrate/20220113144323_create_storage.rb
+++ b/db/migrate/20220113144323_create_storage.rb
@@ -3,12 +3,9 @@ class CreateStorage < ActiveRecord::Migration[6.1]
create_table :storages do |t|
t.string :provider_type
t.string :name
- t.bigint :creator_id, null: false, foreign_key: true
- t.string :identifier, null: false
+ t.references :creator, null: false, index: true, foreign_key: { to_table: :users }
t.timestamps
-
- t.index :identifier
end
end
end
diff --git a/modules/storages/app/models/storages/storage.rb b/modules/storages/app/models/storages/storage.rb
index 2e4f56d915e..c73a9bb1cbe 100644
--- a/modules/storages/app/models/storages/storage.rb
+++ b/modules/storages/app/models/storages/storage.rb
@@ -33,7 +33,6 @@ class Storages::Storage < ApplicationRecord
belongs_to :creator, class_name: 'User'
has_many :projects_storages, dependent: :destroy, class_name: 'Storages::ProjectStorage'
has_many :projects, through: :projects_storages
- has_secure_token :identifier
PROVIDER_TYPES = %w[nextcloud].freeze