新增:项目数据集模型
This commit is contained in:
parent
81e916889e
commit
0a13387c1c
|
@ -21,6 +21,7 @@ class ProjectsController < ApplicationController
|
||||||
menu.append(menu_hash_by_name("issues")) if @project.has_menu_permission("issues")
|
menu.append(menu_hash_by_name("issues")) if @project.has_menu_permission("issues")
|
||||||
menu.append(menu_hash_by_name("pulls")) if @project.has_menu_permission("pulls") && @project.forge?
|
menu.append(menu_hash_by_name("pulls")) if @project.has_menu_permission("pulls") && @project.forge?
|
||||||
menu.append(menu_hash_by_name("devops")) if @project.has_menu_permission("devops") && @project.forge?
|
menu.append(menu_hash_by_name("devops")) if @project.has_menu_permission("devops") && @project.forge?
|
||||||
|
menu.append(menu_hash_by_name("dataset")) if @project.has_menu_permission("dataset") && @project.forge?
|
||||||
menu.append(menu_hash_by_name("versions")) if @project.has_menu_permission("versions")
|
menu.append(menu_hash_by_name("versions")) if @project.has_menu_permission("versions")
|
||||||
menu.append(menu_hash_by_name("wiki")) if @project.has_menu_permission("wiki") && @project.forge?
|
menu.append(menu_hash_by_name("wiki")) if @project.has_menu_permission("wiki") && @project.forge?
|
||||||
menu.append(menu_hash_by_name("services")) if @project.has_menu_permission("services") && @project.forge? && (current_user.admin? || @project.member?(current_user.id))
|
menu.append(menu_hash_by_name("services")) if @project.has_menu_permission("services") && @project.forge? && (current_user.admin? || @project.member?(current_user.id))
|
||||||
|
|
|
@ -137,6 +137,7 @@ class Project < ApplicationRecord
|
||||||
has_many :project_topics, through: :project_topic_ralates
|
has_many :project_topics, through: :project_topic_ralates
|
||||||
has_many :commit_logs, dependent: :destroy
|
has_many :commit_logs, dependent: :destroy
|
||||||
has_many :daily_project_statistics, dependent: :destroy
|
has_many :daily_project_statistics, dependent: :destroy
|
||||||
|
has_one :project_dataset, dependent: :destroy
|
||||||
after_create :incre_user_statistic, :incre_platform_statistic
|
after_create :incre_user_statistic, :incre_platform_statistic
|
||||||
after_save :check_project_members
|
after_save :check_project_members
|
||||||
before_save :set_invite_code, :reset_unmember_followed, :set_recommend_and_is_pinned, :reset_cache_data
|
before_save :set_invite_code, :reset_unmember_followed, :set_recommend_and_is_pinned, :reset_cache_data
|
||||||
|
|
|
@ -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
|
|
@ -17,7 +17,7 @@ class ProjectUnit < ApplicationRecord
|
||||||
|
|
||||||
belongs_to :project
|
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}
|
validates :unit_type, uniqueness: { scope: :project_id}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
class CreateProjectDatasets < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :project_datasets do |t|
|
||||||
|
t.string :title
|
||||||
|
t.text :description
|
||||||
|
t.references :project
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue