You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.1 KiB
MySQL

5 years ago
create or replace view sos.v_session as
select
"session".*,
"session_user".user_email as session_user_email,
"session_user".user_email_confirmed as session_user_email_confirmed,
"session_user".user_password_hash as session_user_password_hash,
"session_user".user_time_registered as session_user_time_registered,
"session_user".user_time_email_confirmed as session_user_time_email_confirmed,
"login_link".*
5 years ago
from sos."session"
left join sos."user" "session_user" on "session".session_user_uuid = "session_user".user_uuid
left join sos."login_link" on "session".session_originating_link = "login_link".login_link_uuid;
5 years ago
create or replace view sos.v_login_link as
select
*
5 years ago
from sos."login_link"
left join sos."user" on "login_link".login_link_user_uuid = "user".user_uuid;
5 years ago
create or replace view sos.v_cart as
select
*
5 years ago
from sos."cart"
left join sos."cart_item" on "cart".cart_uuid = "cart_item".cart_item_cart_uuid
left join sos."item" on "cart_item".cart_item_item_uuid = "item".item_uuid;
5 years ago
create or replace view sos.v_item as
select
"item".*,
"image".image_uuid,
"image".image_featured,
"image".image_mime_type,
"image".image_date_uploaded,
"user".user_email
5 years ago
from sos."item"
left join sos."image" on "item".item_uuid = "image".image_item_uuid
left join sos."user" on "image".image_uploader_uuid = "user".user_uuid;
5 years ago
create or replace view sos.v_category as
select
"category".*,
"child_category".category_uuid as child_category_uuid,
"child_category".category_name as child_category_name,
"child_category".category_urlslug as child_category_urlslug,
v_item.*
5 years ago
from sos."category"
left join sos."category_category" on "category".category_uuid = "category_category".category_category_parent_uuid
left join sos."category" "child_category" on "category_category".category_category_child_uuid = "child_category".category_uuid
left join sos."category_item" on "category".category_uuid = "category_item".category_item_category_uuid
left join sos.v_item on "category_item".category_item_item_uuid = item_uuid;