Forums

Migrated from Drupal, need small mysql-push (2 posts)

  1. Philipp
    Member
    Posted 1 year ago #

    Hi there,

    I have almost successfully migrated from Drupal 6 to WordPress 3.03.

    Almost, because I am trying to import my slugs (called url_alias in Drupal) to WordPress. I have all the bits I need, but I am not able to fit it all together so that mysql accepts it. Maybe some mysql pro could help me bit....?

    I have this working:

    SELECT post_name, SUBSTRING(dst, POSITION('/' IN dst)+1) AS Slug
    FROM w3fwp_posts, 553_w3drpfilter.url_alias
    WHERE post_type LIKE 'post'
    AND post_type NOT LIKE 'page'
    AND post_name NOT LIKE ''
    AND post_name = SUBSTRING(dst FROM 1 FOR POSITION('/' IN dst)-1)

    Now I wanted to actually update the wp_posts.post_name using my Slug, but this doesn't work.

    Here's what I did:

    UPDATE wordpress.w3fwp_posts
    	SET post_name = (
        SELECT SUBSTRING(dst, POSITION('/' IN dst)+1)
    FROM w3fwp_posts, 553_w3drpfilter.url_alias
    WHERE post_type LIKE 'post'
    AND post_type NOT LIKE 'page'
    AND post_name NOT LIKE ''
    AND post_name = SUBSTRING(dst FROM 1 FOR POSITION('/' IN dst)-1)
    )

    Any ideas? I'm growing desperate... ;(

  2. Philipp
    Member
    Posted 1 year ago #

    Oh, maybe I should explain the fields some more.

    In Drupal(553_w3drpfilter.url_alias)
    src:'node/9'
    dst:'9/stier-vs-mathador'

    SUBSTRING(dst, POSITION('/' IN dst)+1) AS Slug
    gives me 'stier-vs-mathador'

    SUBSTRING(dst FROM 1 FOR POSITION('/' IN dst)-1)
    gives me '9'

Topic Closed

This topic has been closed to new replies.

About this Topic