ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

change articles channel via database

May 02, 2011 6:52am

Subscribe [3]
  • #1 / May 02, 2011 6:52am

    Martijn La Feber

    11 posts

    I’ve got 100 records labeled on the wrong channel.
    Is it possible to change this via the database, or is there
    a better way?

    Do I change: exp_channel_data
    or both exp_channel_data and Browse exp_channel_titles

    It’s a MSM website: Build: 20101220

  • #2 / May 02, 2011 8:06pm

    Sue Crocker

    26054 posts

    Hi, Martijn.

    What needs to be changed? Do both channels share the same custom fields? My example is going to differ depending on your answer. Are these going to be in the same site?

    In general, there are two tables involved:

    exp_channel_titles
    -and-
    exp_channel_data

    You’ll need to do an update query (after saving your tables before hand):

    update exp_channel_titles set channel_id = 5 where channel_id = 4
    update exp_channel_data set channel_id = 5 where channel_id = 4

    Where 5 is the new channel_id, and 4 is the old.

    NOTE: If you aren’t using the same custom fields, you’re going to run into problems. This only changes the channel_id, not any existing custom field remapping.

    Make sense?

  • #3 / May 03, 2011 6:09am

    Martijn La Feber

    11 posts

    Thanks for the help Sue,
    Just to be sure, I added ‘and site_id = 2’.  So it would only change the corect site.

  • #4 / May 03, 2011 10:40am

    Sue Crocker

    26054 posts

    Good idea. 😊 So all is well, then?

  • #5 / May 03, 2011 12:21pm

    Martijn La Feber

    11 posts

    All is well 😊
    Thanx for the quick help.

  • #6 / May 04, 2011 8:48am

    John Henry Donovan

    12339 posts

    Thanks Martijn, feel free to start a new thread if you have any more questions

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases