Skip to content

Commit 708fdee

Browse files
author
Ben Lerner
committed
change orca_status to a jsonb column instead of a boolean, so that we can incorporate grader status into the database even when the grader doesn't have an upload to use as filesystem storage space
1 parent 6589557 commit 708fdee

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
class ChangeOrcaStatusType < ActiveRecord::Migration[7.0]
2+
def up
3+
add_column :graders, :orca_jsonb_status, :jsonb, default: false, null: false
4+
Grader.reset_column_information
5+
Grader.where(orca_status: true).update_all(orca_jsonb_status: {
6+
current_build: {
7+
completed: true,
8+
succesful: true,
9+
build_time: DateTime.now
10+
},
11+
last_build: nil
12+
})
13+
remove_column :graders, :orca_status
14+
rename_column :graders, :orca_jsonb_status, :orca_status
15+
end
16+
17+
def down
18+
rename_column :graders, :orca_status, :orca_jsonb_status
19+
add_column :graders, :orca_status, :boolean, default: false, null: false
20+
Grader.reset_column_information
21+
Grader.where.not(orca_jsonb_status: false).update_all(orca_status: true)
22+
remove_column :graders, :orca_jsonb_status
23+
end
24+
end

db/schema.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.0].define(version: 2024_07_25_235205) do
13+
ActiveRecord::Schema[7.0].define(version: 2024_08_28_125219) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "plpgsql"
1616

@@ -93,7 +93,7 @@
9393
t.integer "assignment_id", null: false
9494
t.integer "extra_upload_id"
9595
t.boolean "extra_credit", default: false, null: false
96-
t.boolean "orca_status", default: false, null: false
96+
t.jsonb "orca_status", default: false, null: false
9797
end
9898

9999
create_table "grades", force: :cascade do |t|

0 commit comments

Comments
 (0)