Import custom module class gives error

Hendrik Clercx asked on April 16, 2020 18:07

Hello

I have a custom module with several classes. I created a new class in this custom module. I want to export this new class to the test environment. I created an export of my custom module. Then I tried to import this package on the test server but it doesn't import the new class. The table is missing in the database when I check afterwards.

I get the following warning message at the end of the import:

Image Text

In my code I added the following to make sure I can export the class

Image Text

Anyone an idea what could be wrong here?

Correct Answer

Hendrik Clercx answered on July 24, 2020 11:33

Sorry for the late answer. I had to fix the issue the same day, leaving me no option but to create the missing classes by hand. This works but obviously isn't the way to go... I forgot about this question until I had the same issue... :)

@Brenden I did an export of the module via Sites -> Export so that shouldn't be the problem.

@Dimitry The problem was about missing classes not the data, so moving data is irrelevant in this case. Custom modules can't be staged so that's no option as far as I see. The sealed checkbox shouldn't matter for this particular problem as well.

Thanks anyway both for helping.


Answer:

After some more research I found out that you have to select the tables as well when creating your export. You have to select the correct module and the system tables related to this module. This was the reason my tables were not present on the new site where I imported the custom module.

So when creating your export, select the following:

  • Global objects -> Development -> Modules -> [your_module]
  • Global objects -> Development -> System tables -> [your_classes_related_to_module]
1 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on April 16, 2020 18:38

When you created your export package, did it include the missing classes? Exporting the module doesn't necessarily include the classes and all child objects by default. Best to go to Sites > Export

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on April 16, 2020 19:04

Hi Hendrik, Brenden,

In the Export you cannot select individual classes to export, only the entire module. Also, have you sealed the module when exported? Also, IsExportable you need to export-import the data stored in this custom class table. Classes itself should be exportable-importable by default (refer to documentation). Are you trying to move data or class? If data, you need to move both module and data selected.

Other option to consider is using Content Staging to migrate those changes. There you can migrate individual classes without the need to re-import the entire module.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.