|
|
@@ -267,7 +267,7 @@ SQL;
|
|
|
`id` int(11) not null AUTO_INCREMENT,
|
|
|
`namespace` varchar(255) NOT NULL DEFAULT '',
|
|
|
`rootNamespace` varchar(255) NOT NULL DEFAULT '',
|
|
|
- `tableName` varchar(255) NOT NULL DEFAULT '',
|
|
|
+ `idInstanceBase` int(11) NOT NULL DEFAULT 0,
|
|
|
`_createdAt` datetime NOT NULL,
|
|
|
UNIQUE KEY `namespace` (`namespace`),
|
|
|
KEY `rootNamespace` (`rootNamespace`),
|
|
|
@@ -310,16 +310,16 @@ SQL;
|
|
|
}
|
|
|
public static function getInstanceTable($namespace) {
|
|
|
$conf = self::getInstanceConfig($namespace);
|
|
|
- if (!empty($conf['tableName'])) return $conf['tableName'];
|
|
|
+ if (!empty($conf['idInstanceBase'])) return "CRM__#INSTANCE_TABLE__{$conf['idInstanceBase']}";
|
|
|
|
|
|
$rootNs = $conf['rootNamespace'];
|
|
|
$rootConf = self::getInstanceConfig($rootNs);
|
|
|
$instanceTableName = "CRM__#INSTANCE_TABLE__{$rootConf['id']}";
|
|
|
- if (!empty($rootConf['tableName'])) {
|
|
|
+ if (!empty($rootConf['idInstance'])) {
|
|
|
$affected = DB::getPDO()->update("CRM_INSTANCE_CONFIG", 'rootNamespace', $rootNs, [
|
|
|
- 'tableName' => $instanceTableName
|
|
|
+ 'idInstanceBase' => $rootConf['id']
|
|
|
]);
|
|
|
- return $rootConf['tableName'];
|
|
|
+ return $instanceTableName;
|
|
|
}
|
|
|
|
|
|
// TODO: fetch primaryKeyType - TODO: store primaryKey and primaryKeyType in SystemObject item
|
|
|
@@ -334,7 +334,7 @@ SQL;
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin2 COMMENT='{$rootNs} #INSTANCE';
|
|
|
");
|
|
|
$affected = DB::getPDO()->update("CRM_INSTANCE_CONFIG", 'rootNamespace', $rootNs, [
|
|
|
- 'tableName' => $instanceTableName
|
|
|
+ 'idInstanceBase' => $rootConf['id']
|
|
|
]);
|
|
|
return $instanceTableName;
|
|
|
}
|