Add event model
This commit is contained in:
5
app/models/event.rb
Normal file
5
app/models/event.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class Event < ActiveRecord::Base
|
||||
belongs_to :user, polymorphic: true
|
||||
belongs_to :exercise
|
||||
belongs_to :file
|
||||
end
|
12
db/migrate/20180814145059_create_events.rb
Normal file
12
db/migrate/20180814145059_create_events.rb
Normal file
@ -0,0 +1,12 @@
|
||||
class CreateEvents < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :events do |t|
|
||||
t.string :type
|
||||
t.string :data
|
||||
t.belongs_to :user, polymorphic: true, index: true
|
||||
t.belongs_to :exercise, index: true
|
||||
t.belongs_to :file, index: true
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
17
db/schema.rb
17
db/schema.rb
@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20180703125302) do
|
||||
ActiveRecord::Schema.define(version: 20180814145059) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@ -95,6 +95,21 @@ ActiveRecord::Schema.define(version: 20180703125302) do
|
||||
|
||||
add_index "errors", ["submission_id"], name: "index_errors_on_submission_id", using: :btree
|
||||
|
||||
create_table "events", force: :cascade do |t|
|
||||
t.string "type"
|
||||
t.string "data"
|
||||
t.integer "user_id"
|
||||
t.string "user_type"
|
||||
t.integer "exercise_id"
|
||||
t.integer "file_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "events", ["exercise_id"], name: "index_events_on_exercise_id", using: :btree
|
||||
add_index "events", ["file_id"], name: "index_events_on_file_id", using: :btree
|
||||
add_index "events", ["user_type", "user_id"], name: "index_events_on_user_type_and_user_id", using: :btree
|
||||
|
||||
create_table "execution_environments", force: :cascade do |t|
|
||||
t.string "docker_image", limit: 255
|
||||
t.string "name", limit: 255
|
||||
|
Reference in New Issue
Block a user