diff --git a/scripts/category.sql b/scripts/category.sql index 333a39b17..a4a25af01 100644 --- a/scripts/category.sql +++ b/scripts/category.sql @@ -1,8 +1,8 @@ //////////////filter categories prom taxonomy////////////// (SELECT ta.term_id, tm.name, tm.slug -FROM `iatm_orient_2_term_taxonomy` ta -LEFT JOIN iatm_orient_2_terms tm ON ta.`term_id` = tm.term_id -WHERE ta.taxonomy = 'category') +FROM orient_wordpress.`iatm_orient_2_term_taxonomy` ta +LEFT JOIN orient_wordpress.iatm_orient_2_terms tm ON ta.`term_id` = tm.term_id +WHERE ta.taxonomy = 'category' and ta.term_id !=1) UNION @@ -10,3 +10,22 @@ UNION FROM `iatm_orient_term_taxonomy` ta LEFT JOIN iatm_orient_terms tm ON ta.`term_id` = tm.term_id WHERE ta.taxonomy = 'category') + + +INSERT INTO rainlab_blog_categories (id, name,slug) +(SELECT ta.term_id, tm.name, tm.slug +FROM orient_wordpress.`iatm_orient_2_term_taxonomy` ta +LEFT JOIN orient_wordpress.iatm_orient_2_terms tm ON ta.`term_id` = tm.term_id +WHERE ta.taxonomy = 'category' and ta.term_id !=1) + + +SELECT * FROM orient_wordpress.`iatm_orient_2_term_relationships` rl + Inner JOIN orient.rainlab_blog_categories bt on bt.id = rl.term_taxonomy_id + INNER JOIN orient.rainlab_blog_posts rb on rl.object_id = rb.id_en +ORDER BY `bt`.`id` DESC + + +INSERT INTO orient.rainlab_blog_posts_categories (post_id,category_id) +SELECT rb.id, bt.id FROM orient_wordpress.`iatm_orient_2_term_relationships` rl + Inner JOIN orient.rainlab_blog_categories bt on bt.id = rl.term_taxonomy_id + INNER JOIN orient.rainlab_blog_posts rb on rl.object_id = rb.id_en diff --git a/scripts/tags.sql b/scripts/tags.sql index 3e8c29695..8cfbf50c0 100644 --- a/scripts/tags.sql +++ b/scripts/tags.sql @@ -3,3 +3,11 @@ SELECT tm.name, tm.slug,ta.term_id as id_en, 'en' FROM orient_wordpress.`iatm_orient_2_term_taxonomy` ta LEFT JOIN orient_wordpress.iatm_orient_2_terms tm ON ta.`term_id` = tm.term_id WHERE ta.taxonomy = 'post_tag'; + + +INSERT INTO orient.bedard_blogtags_post_tag (tag_id,post_id) +SELECT bt.id, rb.id FROM `iatm_orient_2_term_relationships` rl +LEFT JOIN iatm_orient_2_term_taxonomy tx ON rl.term_taxonomy_id = tx.term_taxonomy_id +LEFT JOIN orient.rainlab_blog_posts rb on rl.object_id = rb.id_en +LEFT JOIN orient.bedard_blogtags_tags bt on bt.id_en = rl.term_taxonomy_id +WHERE tx.taxonomy = 'post_tag'