modxcms / vapor

Create a MODX Cloud compatible snapshot from a MODX site
7 stars 6 forks source link

Is creating major and minor version lengths that are incompatible with mysql column definition #2

Open neoneddy opened 11 years ago

neoneddy commented 11 years ago

Here is the error log I get. I realize there is a forum post with a solution. But that's a per-site and install solution. Seems like Vapor should be outputting proper version number lengths.

 [2013-10-29 19:27:58] (ERROR @ /connectors/workspace/packages.php) Error 22003 executing statement:
INSERT INTO `modx_transport_packages` (`signature`, `created`, `state`, `workspace`, `provider`, `disabled`, `source`, `package_name`, `version_major`, `version_minor`, `version_patch`, `release`, `release_index`) VALUES ('base.modxwireframe.com-131029.1917.03-2.2.10-pl', '2013-10-29 19:27:58', 1, 1, 0, 0, 'base.modxwireframe.com-131029.1917.03-2.2.10-pl.transport.zip', 'base.modxwireframe.com', 131029, 1917, 3, '', 2)
Array
(
    [0] => 22003
    [1] => 1264
    [2] => Out of range value for column 'version_major' at row 1
)
rchouinard commented 10 years ago

The version_% columns are defined as SMALLINT(5), which has a maximum value of 65535, but vapor generates version strings based on date which are much larger than that (today's version_major would be 131126). Older versions of MySQL would silently truncate the data and continue on, but modern versions will kick out an error (as it should; silently munging data is a bad thing for a database to do).

Either modx needs to update the columns to INT(10) or vapor needs a new method of generating version strings. Otherwise, vapor will not work by default with MySQL 5.6+.

opengeek commented 10 years ago

Vapor is not intended for creating packages to be used in Package Management. The out of range version was on purpose.

opengeek commented 10 years ago

Please see https://github.com/modxcms/teleport if you want to create packages usable in package management.

rchouinard commented 10 years ago

I understand the point about teleport vs vapor, but there is still an issue here. First being that the the purposeful out-of-range error is only an error after MySQL 5.6.6; it works just fine on previous versions using the default SQL mode settings. Secondly, don't you think it would be better to throw an intelligible error in these cases rather than force the database to error?