Skip to content

Commit

Permalink
Merge pull request #349 from dgmstuart/dgms/non-nil-frequency
Browse files Browse the repository at this point in the history
Make frequency non nullable in database
  • Loading branch information
dgmstuart authored Apr 8, 2024
2 parents 240eaf9 + 62dad93 commit 58694ea
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class MakeFrequencyNonNullInEvents < ActiveRecord::Migration[7.1]
def change
change_column_null :events, :frequency, 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.1].define(version: 2024_03_31_005709) do
ActiveRecord::Schema[7.1].define(version: 2024_04_08_125449) do
create_schema "heroku_ext"

# These are extensions that must be enabled in order to support this database
Expand Down Expand Up @@ -55,7 +55,7 @@
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.integer "venue_id", null: false
t.integer "frequency"
t.integer "frequency", null: false
t.string "url", limit: 255, null: false
t.date "first_date"
t.date "last_date"
Expand Down
4 changes: 2 additions & 2 deletions spec/system/editors_can_archive_events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
it "raises an error" do
skip_login
event = create(:event, frequency: 0, dates: ["02/01/2000".to_date])
# Set frequency to nil to simulate failed save by making the record invalid:
event.update_attribute(:frequency, nil) # rubocop:disable Rails/SkipsModelValidations
# Set url to an invalid value to simulate failed save
event.update_attribute(:url, "not-a-url") # rubocop:disable Rails/SkipsModelValidations

visit "/events"

Expand Down

0 comments on commit 58694ea

Please sign in to comment.