import

MySQL Views#1356 - View 'pimcore.object_5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

I had issues taking a copy of Pimcore database and import it to another instance having another MySQL user. The reason for this was in the definition of the MySQL View, since it declares the definer and that makes it impossible for the user used for the other instance of Pimcore to read from the View.

Solution:
You have to edit the SQL export file before you import it and replace all original MySQL users with the new one:  ...DEFINER=`pimcore`@`%` SQL...

Import new nodes via script

Just some notes for my own sake.

Some notes regarding importing to nodes using scripts e.g when migrating from one db to another

  • Using the wrong format in node_revision table can make users in some user roles not be able to access the nodes. I had set format to 2. When editing node as admin and save it it changed to format = 0, and then all user with the right permission could access.
    update `node_revisions` set `format` = 0 WHERE nid IN(select nid from node where type like "my_node_type")