Update schema to reflect re-usable error_template_attributes, descriptions, hints, and sorting
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
class ErrorTemplate < ActiveRecord::Base
|
class ErrorTemplate < ActiveRecord::Base
|
||||||
belongs_to :execution_environment
|
belongs_to :execution_environment
|
||||||
|
has_and_belongs_to_many :error_template_attributes
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
class ErrorTemplateAttribute < ActiveRecord::Base
|
class ErrorTemplateAttribute < ActiveRecord::Base
|
||||||
belongs_to :error_template
|
has_and_belongs_to_many :error_template
|
||||||
end
|
end
|
||||||
|
@ -11,6 +11,7 @@ class ExecutionEnvironment < ActiveRecord::Base
|
|||||||
has_many :exercises
|
has_many :exercises
|
||||||
belongs_to :file_type
|
belongs_to :file_type
|
||||||
has_many :hints
|
has_many :hints
|
||||||
|
has_many :error_templates
|
||||||
|
|
||||||
scope :with_exercises, -> { where('id IN (SELECT execution_environment_id FROM exercises)') }
|
scope :with_exercises, -> { where('id IN (SELECT execution_environment_id FROM exercises)') }
|
||||||
|
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
class AddDescriptionAndHintToErrorTemplate < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :error_templates, :description, :text
|
||||||
|
add_column :error_templates, :hint, :text
|
||||||
|
|
||||||
|
add_column :error_template_attributes, :description, :text
|
||||||
|
add_column :error_template_attributes, :important, :boolean
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,6 @@
|
|||||||
|
class ChangeErrorTemplateAttributeRelationshipToNToM < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
remove_belongs_to :error_template_attributes, :error_template
|
||||||
|
create_join_table :error_templates, :error_template_attributes
|
||||||
|
end
|
||||||
|
end
|
16
db/schema.rb
16
db/schema.rb
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20170703080355) do
|
ActiveRecord::Schema.define(version: 20170711170928) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@ -48,11 +48,17 @@ ActiveRecord::Schema.define(version: 20170703080355) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
create_table "error_template_attributes", force: :cascade do |t|
|
create_table "error_template_attributes", force: :cascade do |t|
|
||||||
t.integer "error_template_id"
|
|
||||||
t.string "key"
|
t.string "key"
|
||||||
t.string "regex"
|
t.string "regex"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.text "description"
|
||||||
|
t.boolean "important"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "error_template_attributes_templates", id: false, force: :cascade do |t|
|
||||||
|
t.integer "error_template_id", null: false
|
||||||
|
t.integer "error_template_attribute_id", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "error_templates", force: :cascade do |t|
|
create_table "error_templates", force: :cascade do |t|
|
||||||
@ -61,6 +67,8 @@ ActiveRecord::Schema.define(version: 20170703080355) do
|
|||||||
t.string "signature"
|
t.string "signature"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.text "description"
|
||||||
|
t.text "hint"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "errors", force: :cascade do |t|
|
create_table "errors", force: :cascade do |t|
|
||||||
|
Reference in New Issue
Block a user