bricoleurs / bricolage

Content management and publishing system
http://www.bricolagecms.org/
111 stars 51 forks source link

Upgrade from version 2.0.1 fails. Potential fix provided. #64

Open dse opened 7 years ago

dse commented 7 years ago

Hi,

I'm trying to upgrade a bricolage 2.0.1 installation to the latest code from github. When I do a make upgrade I get the following error:

Couldn't find version "2.0.1" in inst/versions.txt

Of course when I add 2.0.1 to versions.txt (in the right order) and try make upgrade again I get this error:

ERROR: DATABASE UPDATE FAILED!

The database was not affected. Please address this issue before continuing.

The error encountered was:

DBD::Pg::st execute failed: ERROR:  column "distributor" is of type boolean but expression is of type integer
LINE 5: ...       'Class with methods to move files via Amazon S3.', 1)
                                                                     ^
HINT:  You will need to rewrite or cast the expression. [for Statement "
    INSERT INTO class (id, key_name, pkg_name, disp_name, plural_name,
                       description, distributor)
    VALUES (82, 's3', 'Bric::Util::Trans::S3', 'Amazon S3', 'Amazon S3 Transport',
            'Class with methods to move files via Amazon S3.', 1)
"] at /usr/local/bricolage/lib/Bric/Util/DBI.pm line 1138.
Unable to execute SQL statement: DBD::Pg::st execute failed: ERROR:  column "distributor" is of type boolean but expression is of type integer
LINE 5: ...       'Class with methods to move files via Amazon S3.', 1)
                                                                     ^
HINT:  You will need to rewrite or cast the expression. [for Statement "
    INSERT INTO class (id, key_name, pkg_name, disp_name, plural_name,
                       description, distributor)
    VALUES (82, 's3', 'Bric::Util::Trans::S3', 'Amazon S3', 'Amazon S3 Transport',
            'Class with methods to move files via Amazon S3.', 1)
"] at /usr/local/bricolage/lib/Bric/Util/DBI.pm line 1138.

[/usr/local/bricolage/lib/Bric/Util/DBI.pm:1139]
[/root/src/bricolage-master/inst/upgrade/2.1.0/../lib/bric_upgrade.pm:320]
[inst/upgrade/2.1.0/s3_mover.pl:14]
make: *** [db_upgrade] Error 255

Making the following change in inst/upgrade/2.1.0/s3_mover.pl seems to do the trick:

--- inst/upgrade/2.1.0/s3_mover.pl~     2017-06-02 22:45:39.707817011 +0000
+++ inst/upgrade/2.1.0/s3_mover.pl      2017-06-02 22:46:10.399816772 +0000
@@ -15,5 +15,5 @@
     INSERT INTO class (id, key_name, pkg_name, disp_name, plural_name,
                        description, distributor)
     VALUES (82, 's3', 'Bric::Util::Trans::S3', 'Amazon S3', 'Amazon S3 Transport',
-            'Class with methods to move files via Amazon S3.', 1)
+            'Class with methods to move files via Amazon S3.', 't')
 });

This may have to do with the PostgreSQL version I'm running which is 9.1.24 but the SQL code in that file also fails with the same type of error in PostgreSQL 9.3.

Thanks, Darren

theory commented 7 years ago

Thank you. IIRC, we changed the boolean references to all use quoted integers a while back, but we must have missed the upgrade scripts. IOW, this probably would have worked, too:

        'Class with methods to move files via Amazon S3.', '1')

Anyway, I’m glad you got it figured out.