SHARE
TWEET

Untitled

a guest Oct 17th, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- source
  2. drop table if exists users_exported;
  3. drop table if exists projects_exported;
  4. drop table if exists themes_exported;
  5. drop table if exists subscriptions_exported;
  6. drop table if exists addons_exported;
  7. drop table if exists exports_exported;
  8. drop table if exists files_exported;
  9. drop table if exists pano_groups_exported;
  10. drop table if exists panos_exported;
  11. drop table if exists hotspots_exported;
  12.  
  13. create table users_exported as SELECT uuid() as id, id as user_id, name, email, email_verified_at, password, stripe_id, card_brand, card_last_four, remember_token, created_at, updated_at, country, custom_domain, force_premium
  14. FROM users;
  15.  
  16. create table projects_exported as SELECT uuid() as id, p.id as project_id, u.id as user_id, p.title, p.slug, p.settings, p.created_at, p.updated_at, p.custom_domain, p.order_in_dashboard
  17. FROM projects p
  18. left join users_exported u on p.user_id = u.user_id;
  19.  
  20. create table themes_exported as SELECT uuid() as id, t.id as theme_id, p.id as project_id, t.title, t.slug, t.settings, t.`type`, t.created_at, t.updated_at
  21. FROM themes t
  22. left join projects_exported p on t.project_id = p.project_id;
  23.  
  24. create table subscriptions_exported as SELECT uuid() as id, s.id as subscription_id, u.id as user_id, s.name, s.stripe_id, s.stripe_plan, s.quantity, s.trial_ends_at, s.ends_at, s.created_at, s.updated_at
  25. FROM subscriptions s
  26. left join users_exported u on s.user_id = u.user_id;
  27.  
  28. create table addons_exported as SELECT uuid() as id, a.id as addon_id, p.id as project_id, a.title, a.slug, a.settings, a.created_at, a.updated_at
  29. FROM addons a
  30. left join projects_exported p on a.project_id = p.project_id;
  31.  
  32. create table exports_exported as SELECT uuid() as id, e.id as export_id, u.id as user_id, p.id as project_id, e.name, e.url, e.created_at, e.updated_at
  33. FROM exports e
  34. left join users_exported u on e.user_id = u.user_id
  35. left join projects_exported p on p.project_id = e.project_id;
  36.  
  37. create table files_exported as SELECT uuid() as id, f.id as file_id, p.id as project_id, f.title, f.`type`, f.url, f.created_at, f.updated_at
  38. FROM files f
  39. left join projects_exported p on f.project_id = p.project_id;
  40.  
  41. create table pano_groups_exported as SELECT uuid() as id, pg.id as pano_group_id, p.id as project_id, pg.title, pg.`order`, pg.created_at, pg.updated_at
  42. FROM pano_groups pg
  43. left join projects_exported p on pg.project_id = p.project_id;
  44.  
  45. create table panos_exported as SELECT uuid() as id, ps.id as pano_id, p.id as project_id, ps.title, ps.slug, ps.`order`, ps.settings, ps.created_at, ps.updated_at
  46. FROM panos ps
  47. left join projects_exported p on ps.project_id = p.project_id;
  48.  
  49. create table hotspots_exported as SELECT uuid() as id, h.id as hotspot_id, p.id as project_id, pe.id as pano_id, h.`data`, h.title, h.`type`, h.ath, h.atv, h.created_at, h.updated_at
  50. FROM hotspots h
  51. left join projects_exported p on p.project_id = h.project_id
  52. left join panos_exported pe on pe.pano_id = h.pano_id;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top