Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: room advert available_from type #439

Merged
merged 7 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/room_advert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class RoomAdvert < ApplicationRecord
validates :contact, presence: true
validates :description, presence: true
validates :publicly_visible, inclusion: [true, false]
validates :available_from, presence: true

scope :publicly_visible, (-> { where(publicly_visible: true) })
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class UpdateRoomAdvertsAvailableFromStringToDate < ActiveRecord::Migration[7.0]
def change
remove_column :room_adverts, :available_from, :string
add_column :room_adverts, :available_from, :date
change_column_null :room_adverts, :available_from, 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_03_28_205012) do
ActiveRecord::Schema[7.0].define(version: 2024_10_18_155243) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -490,14 +490,14 @@
t.string "house_name", null: false
t.string "contact", null: false
t.string "location"
t.string "available_from"
t.string "description", null: false
t.string "cover_photo"
t.boolean "publicly_visible"
t.integer "author_id"
t.datetime "deleted_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.date "available_from", null: false
end

create_table "static_pages", id: :serial, force: :cascade do |t|
Expand Down
Loading