Migrating old projects from jcb v3 to jcb v5 via database #1142

Open
opened 2024-07-11 23:37:37 +00:00 by oxido · 5 comments

Steps to reproduce the issue

I just tried to move my old projects from JCB v3 to JCB v5, I almost succeeded, but I can't compile the component for joomla 5.
In joomla 3 I used akebabackup to export only the tables from the database that belong to JCB, all of them.
I changed the prefix of the tables in the .sql file to match the prefix from the new Joomla 5.
I imported the .sql file into the joomla 5 database via PhpMyAdmin.
The components, fields and the rest appear in JCB v5, but I can't compile the component for joomla 5 because I get this error:
Field 'modules' doesn't have a default value

Then @Llewellyn told me to: check all your columns that they allow null, and not (not null)
I did, nothing changed.

Expected result

Compile component

Actual result

  1. Folder Path Error
    The folder path: /var/www/html/libraries/phpspreadsheet/vendor does not exist, and was not added!

  2. An error has occurred.
    1364 Field 'modules' doesn't have a default value

`Call Stack

Function Location

1 () - JROOT/libraries/vendor/joomla/database/src/Mysqli/MysqliStatement.php:403

2 Joomla\Database\Mysqli\MysqliStatement->execute() - JROOT/libraries/vendor/joomla/database/src/DatabaseDriver.php:651

3 Joomla\Database\DatabaseDriver->execute() - JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Get.php:2314

4 VDM\Joomla\Componentbuilder\Compiler\Helper\Get->setNewLangStrings() - JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Get.php:2264

System information (as much as possible)

  • OS Name & Version: ubuntu
  • MySql Version: mysqlnd 8.2.8
  • Apache Version: Apache/2.4.57 (Debian)
  • PHP Version: 8.2.8
  • Joomla Version: ‎5.1.2
  • JCB Version: 5.0.1-alpha7
  • Browser: Firefox

Additional comments

### Steps to reproduce the issue I just tried to move my old projects from JCB v3 to JCB v5, I almost succeeded, but I can't compile the component for joomla 5. In joomla 3 I used akebabackup to export only the tables from the database that belong to JCB, all of them. I changed the prefix of the tables in the .sql file to match the prefix from the new Joomla 5. I imported the .sql file into the joomla 5 database via PhpMyAdmin. The components, fields and the rest appear in JCB v5, but I can't compile the component for joomla 5 because I get this error: **Field 'modules' doesn't have a default value** Then @Llewellyn told me to: check all your columns that they allow null, and not (not null) I did, nothing changed. ### Expected result Compile component ### Actual result 1) Folder Path Error The folder path: /var/www/html/libraries/phpspreadsheet/vendor does not exist, and was not added! 2) An error has occurred. 1364 Field 'modules' doesn't have a default value `Call Stack # Function Location 1 () - JROOT/libraries/vendor/joomla/database/src/Mysqli/MysqliStatement.php:403 2 Joomla\Database\Mysqli\MysqliStatement->execute() - JROOT/libraries/vendor/joomla/database/src/DatabaseDriver.php:651 3 Joomla\Database\DatabaseDriver->execute() - JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Get.php:2314 4 VDM\Joomla\Componentbuilder\Compiler\Helper\Get->setNewLangStrings() - JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Get.php:2264 ### System information (as much as possible) - OS Name & Version: ubuntu - MySql Version: mysqlnd 8.2.8 - Apache Version: Apache/2.4.57 (Debian) - PHP Version: 8.2.8 - Joomla Version: ‎5.1.2 - JCB Version: 5.0.1-alpha7 - Browser: Firefox ### Additional comments
oxido changed title from Migrating old projects from jcb v3 to jcb v5 to Migrating old projects from jcb v3 to jcb v5 via database 2024-07-11 23:38:48 +00:00

I once got the advice to update it first to joomla 4 copying all stuff to it and then the same to joomla 5, a lot of work which does not might go well.

What you could try and I also did it before and went OK for me.
Create a temporary joomla 5.x.x installation, then install JCB for that version. then export your JCB DB tables from joomla 3 using phpmyadmin and import them into the Joomla 5 DB. If overwriting the table does not succeed then drop the JCB table and try to import the one from the joomla 3 install again. Then reopen the joomla 5 administrator site and check in JCB if your project is there.

It's a bit of work, but as long as the export and import capabilities are not working, this could be a solution.

I once got the advice to update it first to joomla 4 copying all stuff to it and then the same to joomla 5, a lot of work which does not might go well. What you could try and I also did it before and went OK for me. Create a temporary joomla 5.x.x installation, then install JCB for that version. then export your JCB DB tables from joomla 3 using phpmyadmin and import them into the Joomla 5 DB. If overwriting the table does not succeed then drop the JCB table and try to import the one from the joomla 3 install again. Then reopen the joomla 5 administrator site and check in JCB if your project is there. It's a bit of work, but as long as the export and import capabilities are not working, this could be a solution.
Author

Create a temporary joomla 5.x.x installation, then install JCB for that version. then export your JCB DB tables from joomla 3 using phpmyadmin and import them into the Joomla 5 DB. If overwriting the table does not succeed then drop the JCB table and try to import the one from the joomla 3 install again. Then reopen the joomla 5 administrator site and check in JCB if your project is there.

This is what I did.
A lot has changed from jcb 3 to jcb 5, I think I should make a much simpler transition, not to replace all the tables in jcb, to import only the fields, the admin views, only what is strictly necessary.

> Create a temporary joomla 5.x.x installation, then install JCB for that version. then export your JCB DB tables from joomla 3 using phpmyadmin and import them into the Joomla 5 DB. If overwriting the table does not succeed then drop the JCB table and try to import the one from the joomla 3 install again. Then reopen the joomla 5 administrator site and check in JCB if your project is there. > This is what I did. A lot has changed from jcb 3 to jcb 5, I think I should make a much simpler transition, not to replace all the tables in jcb, to import only the fields, the admin views, only what is strictly necessary.

Yes indeed. I not exactly aware if there are much differences concerning the DB, but indeed just the table which concerns the project should work.

Yes indeed. I not exactly aware if there are much differences concerning the DB, but indeed just the table which concerns the project should work.
Owner

The issue appears to be related to the migration of projects from JCB v3 (Joomla Component Builder) to JCB v5 on a Joomla 5 installation. You encounter an error stating "Field 'modules' doesn't have a default value" when attempting to compile a component.

Problem Analysis

  1. Database Migration Issue: When migrating the database tables from JCB v3 to JCB v5, the SQL import was performed manually. This may have led to discrepancies in the table schema, particularly regarding default values and nullability constraints.

  2. Modules Field Error: The error specifically mentions the 'modules' field, indicating that this field may not be properly set up to handle null values or might be missing a default value.

  3. Missing Folder Path: There is also a folder path error indicating a missing directory for phpspreadsheet vendor libraries. While this is a separate issue, it's essential to resolve it to ensure full functionality.

Suggested Steps for Resolution

  1. Check and Set Default Values for Columns:

    • Ensure that all necessary columns in your tables, including 'modules', have appropriate default values or are allowed to be null.
  2. Folder Path Error:

    • We have remove the export and import feature from JCB so the phpspreadsheet is no longer in the package (we are working on an alternative).
  3. Selective Data Migration:

    • Instead of migrating all tables and data, selectively migrate only the essential data fields, admin views, etc., to avoid schema conflicts.
  4. Database Schema Alignment:

    • Compare the database schema of JCB v3 and JCB v5 to identify and resolve any differences.

Conclusion

We have moved all our components (many) to Joomla 4 and 5 and this all automatically with simple building for that version from within Joomla 3. We have teams doing this everyday (over and over) so if your not having success we will need more details.

The issue appears to be related to the migration of projects from JCB v3 (Joomla Component Builder) to JCB v5 on a Joomla 5 installation. You encounter an error stating "Field 'modules' doesn't have a default value" when attempting to compile a component. ### Problem Analysis 1. **Database Migration Issue**: When migrating the database tables from JCB v3 to JCB v5, the SQL import was performed manually. This may have led to discrepancies in the table schema, particularly regarding **default values** and **nullability** constraints. 2. **Modules Field Error**: The error specifically mentions the 'modules' field, indicating that this field may not be properly set up to handle null values or might be missing a default value. 3. **Missing Folder Path**: There is also a folder path error indicating a missing directory for `phpspreadsheet` vendor libraries. While this is a separate issue, it's essential to resolve it to ensure full functionality. ### Suggested Steps for Resolution 1. **Check and Set Default Values for Columns**: - Ensure that all necessary columns in your tables, including 'modules', have appropriate default values or are allowed to be null. 2. **Folder Path Error**: - We have remove the export and import feature from JCB so the `phpspreadsheet` is no longer in the package (we are working on an alternative). 3. **Selective Data Migration**: - Instead of migrating all tables and data, selectively migrate only the essential data fields, admin views, etc., to avoid schema conflicts. 4. **Database Schema Alignment**: - Compare the database schema of JCB v3 and JCB v5 to identify and resolve any differences. ### Conclusion We have moved all our components (many) to Joomla 4 and 5 and this all automatically with simple building for that version from within Joomla 3. We have teams doing this everyday (over and over) so if your not having success we will need more details.
Author

It kind of worked by exporting these tables from joomla 3, JCB v3 and importing them into joomla5, JCB v5.
In Joomla5 & JCB v5, after compilation, when I was trying to install the component, I had a problem with a custom field "created" meant to overwrite the default field that appears in the "publishing" tab.

JInstaller: :Install: Error SQL Invalid default value for 'created'
Extension installation stopped.

The default value of the field was "NOW", but didn't work even with the empty value, so I removed the custom field "created".

#__componentbuilder_admin_custom_tabs
#__componentbuilder_admin_fields
#__componentbuilder_admin_fields_conditions
#__componentbuilder_admin_fields_relations
#__componentbuilder_admin_view
#__componentbuilder_class_extends
#__componentbuilder_class_method
#__componentbuilder_class_property
#__componentbuilder_component_admin_views
#__componentbuilder_component_config
#__componentbuilder_component_placeholders
#__componentbuilder_component_plugins
#__componentbuilder_custom_code
#__componentbuilder_dynamic_get
#__componentbuilder_field
#__componentbuilder_fieldtype
#__componentbuilder_joomla_component
#__componentbuilder_joomla_plugin
#__componentbuilder_joomla_plugin_files_folders_urls
#__componentbuilder_joomla_plugin_group
#__componentbuilder_joomla_plugin_updates

This worked for me.

It kind of worked by exporting these tables from joomla 3, JCB v3 and importing them into joomla5, JCB v5. In Joomla5 & JCB v5, after compilation, when I was trying to install the component, I had a problem with a custom field "created" meant to overwrite the default field that appears in the "publishing" tab. ``` JInstaller: :Install: Error SQL Invalid default value for 'created' Extension installation stopped. ``` The default value of the field was "NOW", but didn't work even with the empty value, so I removed the custom field "created". ``` #__componentbuilder_admin_custom_tabs #__componentbuilder_admin_fields #__componentbuilder_admin_fields_conditions #__componentbuilder_admin_fields_relations #__componentbuilder_admin_view #__componentbuilder_class_extends #__componentbuilder_class_method #__componentbuilder_class_property #__componentbuilder_component_admin_views #__componentbuilder_component_config #__componentbuilder_component_placeholders #__componentbuilder_component_plugins #__componentbuilder_custom_code #__componentbuilder_dynamic_get #__componentbuilder_field #__componentbuilder_fieldtype #__componentbuilder_joomla_component #__componentbuilder_joomla_plugin #__componentbuilder_joomla_plugin_files_folders_urls #__componentbuilder_joomla_plugin_group #__componentbuilder_joomla_plugin_updates ``` **This worked for me.**
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1142
No description provided.