ORIENT/scripts/category.sql

92 lines
5.2 KiB
MySQL
Raw Permalink Normal View History

//////////////filter categories prom taxonomy//////////////
(SELECT ta.term_id, tm.name, tm.slug
2021-03-29 13:12:05 +00:00
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
(SELECT ta.term_id, tm.name, tm.slug
FROM `iatm_orient_term_taxonomy` ta
LEFT JOIN iatm_orient_terms tm ON ta.`term_id` = tm.term_id
WHERE ta.taxonomy = 'category')
2021-03-29 13:12:05 +00:00
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
2021-04-08 08:08:59 +00:00
2021-05-11 09:30:10 +00:00
INSERT INTO orient.rainlab_blog_posts_categories (post_id,category_id)
SELECT rb.id, bt.id FROM term_relationships_converted rl
Inner JOIN rainlab_blog_categories bt on bt.id = rl.term_taxonomy_id
INNER JOIN rainlab_blog_posts rb on rl.object_id = rb.id_ru
2021-05-01 12:58:38 +00:00
2021-05-15 08:30:00 +00:00
update last_relationships SET term_taxonomy_id = 9 where term_taxonomy_id = 2;
update last_relationships SET term_taxonomy_id = 8 where term_taxonomy_id = 5;
update last_relationships SET term_taxonomy_id = 5 where term_taxonomy_id = 3;
update last_relationships SET term_taxonomy_id = 2508 where term_taxonomy_id = 13;
update last_relationships SET term_taxonomy_id = 13 where term_taxonomy_id = 10;
update last_relationships SET term_taxonomy_id = 10 where term_taxonomy_id = 6;
update last_relationships SET term_taxonomy_id = 2509 where term_taxonomy_id = 11;
update last_relationships SET term_taxonomy_id = 11 where term_taxonomy_id = 7;
update last_relationships SET term_taxonomy_id = 6 where term_taxonomy_id = 23;
update last_relationships SET term_taxonomy_id = 7 where term_taxonomy_id = 26;
update last_relationships SET term_taxonomy_id = 2510 where term_taxonomy_id = 14;
update last_relationships SET term_taxonomy_id = 14 where term_taxonomy_id = 29;
update last_relationships SET term_taxonomy_id = 12 where term_taxonomy_id = 41;
update last_relationships SET term_taxonomy_id = 2511 where term_taxonomy_id = 793;
update last_relationships SET term_taxonomy_id = 793 where term_taxonomy_id = 101;
update last_relationships SET term_taxonomy_id = 2512 where term_taxonomy_id = 621;
update last_relationships SET term_taxonomy_id = 621 where term_taxonomy_id = 696;
2021-04-08 08:08:59 +00:00
2021-05-11 09:30:10 +00:00
update iatm_orient_terms SET term_id = 9 where term_id = 2;
update iatm_orient_terms SET term_id = 8 where term_id = 5;
update iatm_orient_terms SET term_id = 5 where term_id = 3;
update iatm_orient_terms SET term_id = 13 where term_id = 10;
update iatm_orient_terms SET term_id = 10 where term_id = 6;
update iatm_orient_terms SET term_id = 11 where term_id = 7;
update iatm_orient_terms SET term_id = 6 where term_id = 23;
update iatm_orient_terms SET term_id = 7 where term_id = 26;
update iatm_orient_terms SET term_id = 14 where term_id = 29;
update iatm_orient_terms SET term_id = 12 where term_id = 41;
update iatm_orient_terms SET term_id = 793 where term_id = 101;
update iatm_orient_terms SET term_id = 621 where term_id = 696;
update iatm_orient_term_taxonomy SET term_id = 9 where term_id = 2;
update iatm_orient_term_taxonomy SET term_id = 8 where term_id = 5;
update iatm_orient_term_taxonomy SET term_id = 5 where term_id = 3;
update iatm_orient_term_taxonomy SET term_id = 13 where term_id = 10;
update iatm_orient_term_taxonomy SET term_id = 10 where term_id = 6;
update iatm_orient_term_taxonomy SET term_id = 11 where term_id = 7;
update iatm_orient_term_taxonomy SET term_id = 6 where term_id = 23;
update iatm_orient_term_taxonomy SET term_id = 7 where term_id = 26;
update iatm_orient_term_taxonomy SET term_id = 14 where term_id = 29;
update iatm_orient_term_taxonomy SET term_id = 12 where term_id = 41;
update iatm_orient_term_taxonomy SET term_id = 793 where term_id = 101;
update iatm_orient_term_taxonomy SET term_id = 621 where term_id = 696;
2021-04-08 08:08:59 +00:00
2021-05-01 12:58:38 +00:00
INSERT INTO rainlab_blog_posts_categories (post_id,category_id)
SELECT rb.id, bt.id FROM `iatm_orient_term_relationships` rl
Inner JOIN rainlab_blog_categories bt on bt.id = rl.term_taxonomy_id
INNER JOIN rainlab_blog_posts rb on rl.object_id = rb.id_ru and rb.locale='ru'
2021-05-15 08:30:00 +00:00
update last_relationships_en lr INNER join rainlab_blog_posts rb on lr.object_id = rb.id_en
set lr.object_id = rb.id
INSERT INTO rainlab_blog_posts_categories (post_id,category_id)
SELECT rl.object_id, rl.term_taxonomy_id FROM last_relationships_en rl where rl.term_taxonomy_id in (SELECT id FROM orient_temp.rainlab_blog_categories)