新增:项目数据集模型

This commit is contained in:
2024-04-01 15:24:34 +08:00
parent 81e916889e
commit 0a13387c1c
5 changed files with 35 additions and 1 deletions

View File

@@ -137,6 +137,7 @@ class Project < ApplicationRecord
has_many :project_topics, through: :project_topic_ralates
has_many :commit_logs, dependent: :destroy
has_many :daily_project_statistics, dependent: :destroy
has_one :project_dataset, dependent: :destroy
after_create :incre_user_statistic, :incre_platform_statistic
after_save :check_project_members
before_save :set_invite_code, :reset_unmember_followed, :set_recommend_and_is_pinned, :reset_cache_data

View File

@@ -0,0 +1,21 @@
# == Schema Information
#
# Table name: project_datasets
#
# id :integer not null, primary key
# title :string(255)
# description :text(65535)
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_project_datasets_on_project_id (project_id)
#
class ProjectDataset < ApplicationRecord
belongs_to :project
end

View File

@@ -17,7 +17,7 @@ class ProjectUnit < ApplicationRecord
belongs_to :project
enum unit_type: {code: 1, issues: 2, pulls: 3, wiki:4, devops: 5, versions: 6, resources: 7, services: 8}
enum unit_type: {code: 1, issues: 2, pulls: 3, wiki:4, devops: 5, versions: 6, resources: 7, services: 8, dataset: 9}
validates :unit_type, uniqueness: { scope: :project_id}