what2watch/migrations/20240409233522_views.up.sql

7 lines
835 B
MySQL
Raw Normal View History

2024-04-14 22:22:26 +00:00
-- human-friendly views with joined fields and string julids
create view if not exists w as select julid_string(id) id, kind, title, metadata_url, length, release_date, last_updated from watches;
2024-04-10 00:44:37 +00:00
create view if not exists s as select julid_string(id) id, name, born, died from stars;
2024-04-14 22:22:26 +00:00
create view if not exists u as select julid_string(id) id, username, displayname, email, (select username from users where id = invited_by) invited_by, last_seen, last_updated from users;
create view if not exists i as select julid_string(invites.id) id, users.username, expires_at, remaining, invites.last_updated from invites inner join users on users.id = owner;
2024-04-14 22:22:26 +00:00
create view if not exists q as select users.username, watches.title, julid_string(watch) from watch_quests inner join users on users.id = user inner join watches on watch = watches.id;