moving to MB custom tables

Support MB Custom Table moving to MB custom tables

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #14289
    tsttechtsttech
    Participant

    Dear Support,

    I have a question. I have an old site which I created custom fields for the user section, pre-custom tables. Now I am moving the data over to a new site and wondering if i move the data over with custom tables installed. Will that data be moved into that custom table.

    I have the MB builder installed, so would i just have to set the custom tables in the settings section of the field group?

    Thank you

    #14322
    Anh TranAnh Tran
    Keymaster

    Hi Dave,

    I'm afraid you have to write a custom script to migrate existing data from custom fields to custom tables. The plugin doesn't auto transfer data for you.

    #14337
    tsttechtsttech
    Participant

    Dear Tran,
    I was worried you might say that as that is way above my head.

    If you know any where to start learning how to do it, that would be much appreciated.

    Thank you
    Dave

    #14339
    tsttechtsttech
    Participant

    Dear Tran,

    How would i make a table for the following

    array (
        'id' => 'image_26',
        'type' => 'image',
        'name' => 'Business Logo',
        'max_file_uploads' => 4,
    ),
    

    What SQL data type should i use and do i have to add anything to allow 4 file?

    #14378
    Anh TranAnh Tran
    Keymaster

    Hi Dave,

    Please try this script (put it in your functions.php file and go to this URL: yourdomain.com?action=migrate):

    https://pastebin.com/BPXTEy6H

    The idea of the script is:

    • Make sure it runs only when the URL contains ?action=migrate to avoid running the script on every page load.
    • Query all the posts that need to migrate the data. You should modify the query to get your correct posts.
    • For each post, get the old meta value for each field. Note about the value format to see if it's an array or simple string.
    • Insert the values into the new table. If the value is an array, it need to be serialized.

    The script comes directly from my mind without testing, so please check it first.

    #14383
    tsttechtsttech
    Participant

    Dear Anh,

    Thank you for that and will give it a test.

    Thank you
    Dave

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.