emlog5.1.2 轉 WordPress3.6
沒用工具,直接運算元據庫。

wp_ 是新裝的 WordPress3.6
emlog_是老的資料庫

清空 wp 資料

  1. delete from wp_postmeta
  2. delete from wp_posts
  3. delete from wp_terms
  4. delete from wp_term_relationships
  5. delete from wp_term_taxonomy

複製程式碼

插入分類

  1. insert into wp_terms(name,slug,term_group) SELECT sortname,sid,0 FROM emlog_sort

複製程式碼

插入分類對映

  1. insert into wp_term_taxonomy(term_id,taxonomy,description,parent,count)(select term_id,'category','',0,1 from wp_terms)

複製程式碼

插入新的欄位

  1. alter table `wp_posts` Add column sortid  int null default 0 AFTER `comment_count`

複製程式碼

插入文章

  1. insert
    into wp_posts
    (post_author,post_date,post_date_gmt,post_title,post_content,post_status,comment_status,ping_status,post_password,post_name,to_ping,pinged,post_modified,post_modified_gmt,post_content_filtered,post_parent,guid,menu_order,post_type 
      ,post_mime_type,comment_count,sortid)
  2. select
    1,from_unixtime(date),from_unixtime(date),title,content,'publish','open','open','','','','',from_unixtime(date),from_unixtime(date),'',0,'http://www.domain.com',0,'post','',0,sortid
    from emlog_blog where type='blog'

複製程式碼

插入文章,分類對映

  1. insert
    into wp_term_relationships(object_id,term_taxonomy_id,term_order)
    select a.id,a.term_id,0 from (select id,sortid,0,wp_terms.term_id,slug
    from wp_posts,wp_terms where slug=sortid)a

複製程式碼

更新 guid

  1. update wp_posts set guid='http://www.domain.com/?page_id='+id

複製程式碼

刪除欄位

  1. alter table `wp_posts`  drop column sortid

複製程式碼

over 。看演示。