Module loader installs table with incorrect columns although specified properly. #5321

Open
opened 2026-02-20 16:59:36 -05:00 by deekerman · 0 comments
Owner

Originally created by @jobst on GitHub (Apr 25, 2025).

Issue

When using the module loader to install a module with correct manifest/class/vardefs the table that's created contains ADDITIONAL columns that I do not want nor need.

Below are the various files, note I chopped of most of the other info.

Please use the manifest.php from my previous bug report (https://github.com/salesagility/SuiteCRM/issues/10669)

Class file

<?php
class MyClass extends Basic
{
  public $module_dir = 'MyModule';
  public $table_name = 'mymodule';
  public $object_name = 'MyModule';
  public $new_schema = true;
  public $importable = true;
  public $disable_row_level_security = true;
  // rows
  public $id;
  public $date_entered;
  public $date_modified;                                                                                                                                                                                                
  public $assigned_user_id;
  public $config;
  public function bean_implements($interface)
  {
    switch($interface)
    {
      case 'ACL':
        return false;
    }
    return false;
  }
}

The vardefs.php file

$dictionary['MyModule'] = array(
  'table' => 'mymodule',
  'audited' => false,
  'inline_edit' => false,
  'duplicate_merge' => false,
  'fields' => array (
    'id' => array(
      'name'           => 'id',
      'type'           => 'int',
      'required'       => true,
      'audited'        => false,
      'auto_increment' => true
    ),
    'date_entered' => array(
      'name'     => 'date_entered',
      'type'     => 'datetime',
      'required' => true,
      'audited'  => false
    ),
    'date_modified' => array(
      'name'     => 'date_modified',
      'type'     => 'datetime',
      'required' => true,
      'audited'  => false
    ),
    'assigned_user_id' => array(
      'name'     => 'assigned_user_id',
      'type'     => 'char',
      'len'      => '36',
      'required' => true,
      'audited'  => false
    ),
    'config' => array(
      'name'            => 'config',
      'type'            => 'text',
      'required'        => true,
      'importable'      => 'false',
      'duplicate_merge' => 'disabled',
      'audited'         => false
    ),
  ),
  'relationships' => array(),
  'optimistic_locking' => true,
  'unified_search' => true,
  'indices' => array(
    array(
      'name' => 'idx_principals_id',
      'type' => 'unique',
      'fields' => array(
        'id'
      )
    )
  )
);

Yet the create table ends up with the following definition, below is the structure export

CREATE TABLE `mymodule` (
  `id` int NOT NULL,
  `name` varchar(255) COLLATE utf8mb3_bin DEFAULT NULL,
  `date_entered` datetime DEFAULT NULL,
  `date_modified` datetime DEFAULT NULL,
  `modified_user_id` char(36) COLLATE utf8mb3_bin DEFAULT NULL,
  `created_by` char(36) COLLATE utf8mb3_bin DEFAULT NULL,
  `description` text COLLATE utf8mb3_bin,
  `deleted` tinyint(1) DEFAULT '0',
  `assigned_user_id` char(36) COLLATE utf8mb3_bin DEFAULT NULL,
  `config` text COLLATE utf8mb3_bin
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;

Possible Fix

No idea, sorry.

Steps to Reproduce the Issue

1.use my files (manifest, vardefs, class)
2.import via module builder
3.use phpMyAdmin to look as the created table
4.it contains more rows than specified

Context

It's not a problem as my queries most of the time only require a specified set of columns.

The module works but the Module loader should actually listen what columns are specified.

Version

7.14.6

What browser are you currently using?

Firefox

Browser Version

N/A not a browser problem

Environment Information

mysql 8.0.41, php 8.2.28

Operating System and Version

AlmaLinux 8.X (not related to this)

Originally created by @jobst on GitHub (Apr 25, 2025). ### Issue When using the module loader to install a module with correct manifest/class/vardefs the table that's created contains ADDITIONAL columns that I do not want nor need. Below are the various files, note I chopped of most of the other info. Please use the manifest.php from my previous bug report (https://github.com/salesagility/SuiteCRM/issues/10669) Class file ``` <?php class MyClass extends Basic { public $module_dir = 'MyModule'; public $table_name = 'mymodule'; public $object_name = 'MyModule'; public $new_schema = true; public $importable = true; public $disable_row_level_security = true; // rows public $id; public $date_entered; public $date_modified; public $assigned_user_id; public $config; public function bean_implements($interface) { switch($interface) { case 'ACL': return false; } return false; } } ``` The vardefs.php file ``` $dictionary['MyModule'] = array( 'table' => 'mymodule', 'audited' => false, 'inline_edit' => false, 'duplicate_merge' => false, 'fields' => array ( 'id' => array( 'name' => 'id', 'type' => 'int', 'required' => true, 'audited' => false, 'auto_increment' => true ), 'date_entered' => array( 'name' => 'date_entered', 'type' => 'datetime', 'required' => true, 'audited' => false ), 'date_modified' => array( 'name' => 'date_modified', 'type' => 'datetime', 'required' => true, 'audited' => false ), 'assigned_user_id' => array( 'name' => 'assigned_user_id', 'type' => 'char', 'len' => '36', 'required' => true, 'audited' => false ), 'config' => array( 'name' => 'config', 'type' => 'text', 'required' => true, 'importable' => 'false', 'duplicate_merge' => 'disabled', 'audited' => false ), ), 'relationships' => array(), 'optimistic_locking' => true, 'unified_search' => true, 'indices' => array( array( 'name' => 'idx_principals_id', 'type' => 'unique', 'fields' => array( 'id' ) ) ) ); ``` Yet the create table ends up with the following definition, below is the structure export ``` CREATE TABLE `mymodule` ( `id` int NOT NULL, `name` varchar(255) COLLATE utf8mb3_bin DEFAULT NULL, `date_entered` datetime DEFAULT NULL, `date_modified` datetime DEFAULT NULL, `modified_user_id` char(36) COLLATE utf8mb3_bin DEFAULT NULL, `created_by` char(36) COLLATE utf8mb3_bin DEFAULT NULL, `description` text COLLATE utf8mb3_bin, `deleted` tinyint(1) DEFAULT '0', `assigned_user_id` char(36) COLLATE utf8mb3_bin DEFAULT NULL, `config` text COLLATE utf8mb3_bin ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin; ``` ### Possible Fix No idea, sorry. ### Steps to Reproduce the Issue ``` 1.use my files (manifest, vardefs, class) 2.import via module builder 3.use phpMyAdmin to look as the created table 4.it contains more rows than specified ``` ### Context It's not a problem as my queries most of the time only require a specified set of columns. The module works but the Module loader should actually listen what columns are specified. ### Version 7.14.6 ### What browser are you currently using? Firefox ### Browser Version N/A not a browser problem ### Environment Information mysql 8.0.41, php 8.2.28 ### Operating System and Version AlmaLinux 8.X (not related to this)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
starred/SuiteCRM-SuiteCRM#5321
No description provided.