Skip to content

Commit

Permalink
migration so claim#reference cannot be NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
asmega committed Oct 15, 2024
1 parent 66171dd commit 1b36264
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions db/migrate/20241015121145_add_not_null_reference.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddNotNullReference < ActiveRecord::Migration[7.0]
def change
change_column_null :claims, :reference, false
end
end
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_09_24_113642) do
ActiveRecord::Schema[7.0].define(version: 2024_10_15_121145) do
# These are extensions that must be enabled in order to support this database
enable_extension "citext"
enable_extension "pg_trgm"
Expand Down Expand Up @@ -56,7 +56,7 @@
t.string "bank_sort_code", limit: 6
t.string "bank_account_number", limit: 8
t.datetime "submitted_at", precision: nil
t.string "reference", limit: 8
t.string "reference", limit: 8, null: false
t.boolean "has_student_loan"
t.integer "student_loan_country"
t.integer "student_loan_courses"
Expand Down
1 change: 1 addition & 0 deletions spec/factories/claims.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

factory :claim do
started_at { Time.zone.now }
reference { Reference.new.to_s }

transient do
policy { Policies::StudentLoans }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
logged_in_with_tid: true
}.merge(
attributes_for(:claim, :with_dqt_teacher_status)
.except(:started_at)
.except(:started_at, :reference)
)
end

Expand Down

0 comments on commit 1b36264

Please sign in to comment.