Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dse opened this issue Jun 2, 2017 · 1 comment
Open

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

dse opened this issue Jun 2, 2017 · 1 comment

Comments

@dse
Copy link
Contributor

dse commented Jun 2, 2017

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
Copy link
Member

theory commented Jun 3, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants