Custom Table: new data not saved, old data not migrated

Support MB Custom Table Custom Table: new data not saved, old data not migrated

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9890
    MauroMauro
    Participant

    Hello I'm using the latest version of MetaBox. I have 2 issues.
    1) I tried to activate MetaBox AIO and the builder didn't show up at all. I worked around this by installing the separate plug-ins.

    2) I've set up my custom fields as a repeatable group in the MetaBox builder. It looks like everything works fine as long as I do not activate "use custom table" in the meta box setting. Once I do, existing meta box data vanishes (it doesn't get migrated) and new data entered does not get saved.

    What details can I give you to check on this?

    #9894
    MauroMauro
    Participant

    I checked on my DB and no table was created. I guess the hook to create the table isn't triggered when I update the metabox?

    #9922
    MauroMauro
    Participant

    Hello, this is pretty important to me since this is the main reason I'm looking into MetaBox as an alternative to CMB2.

    #9924
    MauroMauro
    Participant

    I tried moving the MetaBox code that was generated by the builder to a custom plug-in.
    I get the same error: the database table does not get created.

    #9929
    Anh TranAnh Tran
    Keymaster

    Hello Mauro,

    Did you create the custom table first? This docs demonstrates how to create the table:

    https://docs.metabox.io/extensions/mb-custom-table/

    It requires some code and you have to put it in your functions.php or the PHP file of your plugin.

    Only after creating the custom table, you can save data into it. Please try it and let me know how it goes.

    #9933
    MauroMauro
    Participant

    Oh, no I didn't do that. I thought that once I specified the storage and table name in the meta box args, it would automatically create and manage the table for me, and that the alternative to create it manually was optional. Will try and let you know.

    So I assume if I switch to a custom table, existing data is not migrated automatically?

    #9936
    Anh TranAnh Tran
    Keymaster

    No, the data is where it is. Only new entries are saved in the custom table. You can write a custom script to migrate if you want.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Custom Table: new data not saved, old data not migrated’ is closed to new replies.