- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbeans_not_in_use.sql
More file actions
Latest commit
24 lines (21 loc) · 840 Bytes
/
Copy pathbeans_not_in_use.sql
File metadata and controls
24 lines (21 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
drop temporary table if exists t1, t2;
# Select all the used responsive landing pages with panes in them
create temporary table if not exists t1 (selectn.nid, nh.vid, pe.didfrom node as n
left join workbench_moderation_node_history as nh onnh.nid=n.nid
left join panelizer_entity as pe onpe.entity_id=n.nidandpe.revision_id=nh.vid
wheren.type='responsive_landing_page'
and (nh.published=1||nh.is_current=1)
andpe.didis not null
order bype.did);
# Beans that are in use
create temporary table if not exists t2 (select distinct b.*from t1
left join panels_pane as pp onpp.did=t1.did
left join bean as b onb.delta=REPLACE(pp.subtype, 'bean-', '')
wherepp.type='block'
andb.bidis not null
order by bid);
# Beans not in use
select*from bean as b
left join t2 ont2.bid=b.bid
wheret2.bid is null
andb.type="text_only"