backend/db/migrate/20180405234855_create_book_notes_view.rb
ROM::SQL.migration do
change do
view_query = self[:notes]
.join(:elements, id: :element_id)
.join(:chapters, id: :chapter_id)
.join(:commits, id: :commit_id)
.join(:branches, id: :branch_id)
.select_all(:notes)
.select_append(Sequel[:branches][:book_id])
create_view :book_notes, view_query
end
end