Add structured errors to schema
This commit is contained in:
3
app/models/error_template.rb
Normal file
3
app/models/error_template.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class ErrorTemplate < ActiveRecord::Base
|
||||||
|
belongs_to :execution_environment
|
||||||
|
end
|
3
app/models/error_template_attribute.rb
Normal file
3
app/models/error_template_attribute.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class ErrorTemplateAttribute < ActiveRecord::Base
|
||||||
|
belongs_to :error_template
|
||||||
|
end
|
4
app/models/structured_error.rb
Normal file
4
app/models/structured_error.rb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
class StructuredError < ActiveRecord::Base
|
||||||
|
belongs_to :error_template
|
||||||
|
belongs_to :file, class_name: 'CodeOcean::File'
|
||||||
|
end
|
4
app/models/structured_error_attribute.rb
Normal file
4
app/models/structured_error_attribute.rb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
class StructuredErrorAttribute < ActiveRecord::Base
|
||||||
|
belongs_to :structured_error
|
||||||
|
belongs_to :error_template_attribute
|
||||||
|
end
|
11
db/migrate/20170703075832_create_error_templates.rb
Normal file
11
db/migrate/20170703075832_create_error_templates.rb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
class CreateErrorTemplates < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :error_templates do |t|
|
||||||
|
t.belongs_to :execution_environment
|
||||||
|
t.string :name
|
||||||
|
t.string :signature
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,11 @@
|
|||||||
|
class CreateErrorTemplateAttributes < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :error_template_attributes do |t|
|
||||||
|
t.belongs_to :error_template
|
||||||
|
t.string :key
|
||||||
|
t.string :regex
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
10
db/migrate/20170703080205_create_structured_errors.rb
Normal file
10
db/migrate/20170703080205_create_structured_errors.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class CreateStructuredErrors < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :structured_errors do |t|
|
||||||
|
t.references :error_template
|
||||||
|
t.belongs_to :file
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,11 @@
|
|||||||
|
class CreateStructuredErrorAttributes < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :structured_error_attributes do |t|
|
||||||
|
t.belongs_to :structured_error
|
||||||
|
t.references :error_template_attribute
|
||||||
|
t.string :value
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
33
db/schema.rb
33
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: 20170608141612) do
|
ActiveRecord::Schema.define(version: 20170703080355) 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"
|
||||||
@ -47,6 +47,22 @@ ActiveRecord::Schema.define(version: 20170608141612) do
|
|||||||
t.string "oauth_secret", limit: 255
|
t.string "oauth_secret", limit: 255
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "error_template_attributes", force: :cascade do |t|
|
||||||
|
t.integer "error_template_id"
|
||||||
|
t.string "key"
|
||||||
|
t.string "regex"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "error_templates", force: :cascade do |t|
|
||||||
|
t.integer "execution_environment_id"
|
||||||
|
t.string "name"
|
||||||
|
t.string "signature"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "errors", force: :cascade do |t|
|
create_table "errors", force: :cascade do |t|
|
||||||
t.integer "execution_environment_id"
|
t.integer "execution_environment_id"
|
||||||
t.text "message"
|
t.text "message"
|
||||||
@ -268,6 +284,21 @@ ActiveRecord::Schema.define(version: 20170608141612) do
|
|||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "structured_error_attributes", force: :cascade do |t|
|
||||||
|
t.integer "structured_error_id"
|
||||||
|
t.integer "error_template_attribute_id"
|
||||||
|
t.string "value"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "structured_errors", force: :cascade do |t|
|
||||||
|
t.integer "error_template_id"
|
||||||
|
t.integer "file_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "submissions", force: :cascade do |t|
|
create_table "submissions", force: :cascade do |t|
|
||||||
t.integer "exercise_id"
|
t.integer "exercise_id"
|
||||||
t.float "score"
|
t.float "score"
|
||||||
|
7
test/factories/error_template_attributes.rb
Normal file
7
test/factories/error_template_attributes.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :error_template_attribute do
|
||||||
|
error_template nil
|
||||||
|
key "MyString"
|
||||||
|
regex "MyString"
|
||||||
|
end
|
||||||
|
end
|
7
test/factories/error_templates.rb
Normal file
7
test/factories/error_templates.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :error_template do
|
||||||
|
execution_environment nil
|
||||||
|
name "MyString"
|
||||||
|
signature "MyString"
|
||||||
|
end
|
||||||
|
end
|
7
test/factories/structured_error_attributes.rb
Normal file
7
test/factories/structured_error_attributes.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :structured_error_attribute do
|
||||||
|
structured_error nil
|
||||||
|
error_template_attribute nil
|
||||||
|
value "MyString"
|
||||||
|
end
|
||||||
|
end
|
6
test/factories/structured_errors.rb
Normal file
6
test/factories/structured_errors.rb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :structured_error do
|
||||||
|
error_template nil
|
||||||
|
file nil
|
||||||
|
end
|
||||||
|
end
|
7
test/models/error_template_attribute_test.rb
Normal file
7
test/models/error_template_attribute_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class ErrorTemplateAttributeTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
7
test/models/error_template_test.rb
Normal file
7
test/models/error_template_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class ErrorTemplateTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
7
test/models/structured_error_attribute_test.rb
Normal file
7
test/models/structured_error_attribute_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class StructuredErrorAttributeTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
7
test/models/structured_error_test.rb
Normal file
7
test/models/structured_error_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class StructuredErrorTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Reference in New Issue
Block a user