From d1dd9c25b91eacaebda4e19a4c148db2b41ef0e7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 17 Dec 2019 18:32:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=98=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/curriculum.rb | 2 ++ app/models/knowledge_point.rb | 3 +++ app/models/knowledge_point_container.rb | 3 +++ db/migrate/20191217100300_create_curriculums.rb | 9 +++++++++ db/migrate/20191217102106_create_knowledge_points.rb | 10 ++++++++++ ...0191217102414_create_knowledge_point_containers.rb | 11 +++++++++++ spec/models/curriculum_spec.rb | 5 +++++ spec/models/knowledge_point_container_spec.rb | 5 +++++ spec/models/knowledge_point_spec.rb | 5 +++++ 9 files changed, 53 insertions(+) create mode 100644 app/models/curriculum.rb create mode 100644 app/models/knowledge_point.rb create mode 100644 app/models/knowledge_point_container.rb create mode 100644 db/migrate/20191217100300_create_curriculums.rb create mode 100644 db/migrate/20191217102106_create_knowledge_points.rb create mode 100644 db/migrate/20191217102414_create_knowledge_point_containers.rb create mode 100644 spec/models/curriculum_spec.rb create mode 100644 spec/models/knowledge_point_container_spec.rb create mode 100644 spec/models/knowledge_point_spec.rb diff --git a/app/models/curriculum.rb b/app/models/curriculum.rb new file mode 100644 index 000000000..6c25a5883 --- /dev/null +++ b/app/models/curriculum.rb @@ -0,0 +1,2 @@ +class Curriculum < ApplicationRecord +end diff --git a/app/models/knowledge_point.rb b/app/models/knowledge_point.rb new file mode 100644 index 000000000..f5abbb54e --- /dev/null +++ b/app/models/knowledge_point.rb @@ -0,0 +1,3 @@ +class KnowledgePoint < ApplicationRecord + belongs_to :curriculum +end diff --git a/app/models/knowledge_point_container.rb b/app/models/knowledge_point_container.rb new file mode 100644 index 000000000..ea73d00e7 --- /dev/null +++ b/app/models/knowledge_point_container.rb @@ -0,0 +1,3 @@ +class KnowledgePointContainer < ApplicationRecord + belongs_to :knowledge_point +end diff --git a/db/migrate/20191217100300_create_curriculums.rb b/db/migrate/20191217100300_create_curriculums.rb new file mode 100644 index 000000000..10eb516d5 --- /dev/null +++ b/db/migrate/20191217100300_create_curriculums.rb @@ -0,0 +1,9 @@ +class CreateCurriculums < ActiveRecord::Migration[5.2] + def change + create_table :curriculums do |t| + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20191217102106_create_knowledge_points.rb b/db/migrate/20191217102106_create_knowledge_points.rb new file mode 100644 index 000000000..7e0220c81 --- /dev/null +++ b/db/migrate/20191217102106_create_knowledge_points.rb @@ -0,0 +1,10 @@ +class CreateKnowledgePoints < ActiveRecord::Migration[5.2] + def change + create_table :knowledge_points do |t| + t.references :curriculum, foreign_key: true + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20191217102414_create_knowledge_point_containers.rb b/db/migrate/20191217102414_create_knowledge_point_containers.rb new file mode 100644 index 000000000..32f92f3e5 --- /dev/null +++ b/db/migrate/20191217102414_create_knowledge_point_containers.rb @@ -0,0 +1,11 @@ +class CreateKnowledgePointContainers < ActiveRecord::Migration[5.2] + def change + create_table :knowledge_point_containers do |t| + t.integer :container_id + t.string :container_type + t.references :knowledge_point, foreign_key: true + + t.timestamps + end + end +end diff --git a/spec/models/curriculum_spec.rb b/spec/models/curriculum_spec.rb new file mode 100644 index 000000000..b03089a91 --- /dev/null +++ b/spec/models/curriculum_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Curriculum, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/knowledge_point_container_spec.rb b/spec/models/knowledge_point_container_spec.rb new file mode 100644 index 000000000..3e151062f --- /dev/null +++ b/spec/models/knowledge_point_container_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe KnowledgePointContainer, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/knowledge_point_spec.rb b/spec/models/knowledge_point_spec.rb new file mode 100644 index 000000000..d85138a0f --- /dev/null +++ b/spec/models/knowledge_point_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe KnowledgePoint, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end