Add a migration that creates the schedule_joined view

It makes it easier to query this data.
This commit is contained in:
gg 2023-07-19 19:40:03 -07:00
parent 723a5b1b68
commit d41ef65a7d
1 changed files with 8 additions and 0 deletions

8
sql/01.views.sql Normal file
View File

@ -0,0 +1,8 @@
-- Create a view that's easier to query
CREATE VIEW schedule_joined AS
SELECT seg.n AS title,
c.n AS caster,
s.jst AS jst
FROM schedule s
JOIN segment seg ON seg.id = s.segment_id
LEFT JOIN caster c ON c.id = s.caster_id;