题库的数据结构调整

chromesetting
cxt 5 years ago
parent 3130adbb31
commit 6567a517cf

@ -1,4 +0,0 @@
class Curriculum < ApplicationRecord
belongs_to :curriculum_direction
has_many :knowledge_points, dependent: :destroy
end

@ -1,4 +0,0 @@
class CurriculumDirection < ApplicationRecord
has_many :curriculums
has_many :knowledge_points
end

@ -3,8 +3,6 @@ class ItemBank < ApplicationRecord
# item_type: 0 单选 1 多选 2 判断 3 填空 4 简答 5 实训 6 编程
enum item_type: { SINGLE: 0, MULTIPLE: 1, JUDGMENT: 2, COMPLETION: 3, SUBJECTIVE: 4, PRACTICAL: 5, PROGRAM: 6 }
belongs_to :curriculum
belongs_to :curriculum_direction
belongs_to :user
has_one :item_analysis, dependent: :destroy

@ -1,5 +0,0 @@
class KnowledgePoint < ApplicationRecord
belongs_to :curriculum_direction
belongs_to :curriculum
has_many :knowledge_point_containers, dependent: :destroy
end

@ -1,3 +0,0 @@
class KnowledgePointContainer < ApplicationRecord
belongs_to :knowledge_point
end

@ -1,9 +0,0 @@
class CreateCurriculumDirections < ActiveRecord::Migration[5.2]
def change
create_table :curriculum_directions do |t|
t.string :name
t.timestamps
end
end
end

@ -1,10 +0,0 @@
class CreateCurriculums < ActiveRecord::Migration[5.2]
def change
create_table :curriculums do |t|
t.string :name
t.references :curriculum_direction, index: true
t.timestamps
end
end
end

@ -1,11 +0,0 @@
class CreateKnowledgePoints < ActiveRecord::Migration[5.2]
def change
create_table :knowledge_points do |t|
t.string :name
t.references :curriculum_direction, index: true
t.references :curriculum, index: true
t.timestamps
end
end
end

@ -1,12 +0,0 @@
class CreateKnowledgePointContainers < ActiveRecord::Migration[5.2]
def change
create_table :knowledge_point_containers do |t|
t.references :knowledge_point
t.integer :container_id
t.string :container_type
t.timestamps
end
add_index :knowledge_point_containers, [:knowledge_point_id, :container_id, :container_type], name: "container_index", unique: true
end
end

@ -1,5 +0,0 @@
require 'rails_helper'
RSpec.describe CurriculumDirection, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -1,5 +0,0 @@
require 'rails_helper'
RSpec.describe Curriculum, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -1,5 +0,0 @@
require 'rails_helper'
RSpec.describe KnowledgePointContainer, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -1,5 +0,0 @@
require 'rails_helper'
RSpec.describe KnowledgePoint, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save