FIX 解决forked项目删除后,fork user没有关联删除的bug

This commit is contained in:
Jasder 2020-08-29 12:07:06 +08:00
parent dc3ec48b8c
commit ef4578286f
2 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,6 @@
class ForkUser < ApplicationRecord
belongs_to :project
belongs_to :project
belongs_to :user
belongs_to :fork_project, class_name: 'ForkUser', foreign_key: :fork_project_id
end

View File

@ -18,6 +18,7 @@ class Project < ApplicationRecord
has_many :project_trends, dependent: :destroy
has_many :watchers, as: :watchable, dependent: :destroy
has_many :fork_users, dependent: :destroy
has_many :forked_users, class_name: 'ForkUser', foreign_key: :fork_project_id, dependent: :destroy
# has_many :commits, dependent: :destroy
has_one :project_score, dependent: :destroy