bringyourownideas / silverstripe-maintenance

Helps with the day by day work to run a SilverStripe application or website.
https://bringyourownideas.com
BSD 3-Clause "New" or "Revised" License
31 stars 10 forks source link

Module doesn't work on Postgres #201

Open elliot-sawyer opened 1 year ago

elliot-sawyer commented 1 year ago

[2023-08-08 04:07:32] error-log.ERROR: Couldn't run query: INSERT INTO "Package" ("ClassName", "Name", "Version", "Type", "Description", "Supported", "LastEdited", "Created") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) ERROR: value too long for type character varying(255) {"exception":"[object] (SilverStripe\\ORM\\Connect\\DatabaseException(code: 0): Couldn't run query:\n\nINSERT INTO \"Package\"\n (\"ClassName\", \"Name\", \"Version\", \"Type\", \"Description\", \"Supported\", \"LastEdited\", \"Created\")\n VALUES\n ($1, $2, $3, $4, $5, $6, $7, $8)\n\nERROR: value too long for type character varying(255) at /var/www/html/vendor/silverstripe/framework/src/ORM/Connect/DBConnector.php:64)"} []

Issue seems to be when one of the fields (guessing Description) contains a value that's too long to fit in the column. MySQL will truncate the value to fit, while Postgres will reject it for being too long

To get around this, I passed in the following YML:


BringYourOwnIdeas\Maintenance\Model\Package:
  db:
    Name: Text
    Description: Text
    Version: Text
    Type: Text

Not sure I should make a PR for this, since Postgres isn't a requirement to run, but leaving this here in case it helps someone else

GuySartorelli commented 1 year ago

Hi, thanks for this. We probably don't want the description being truncated - if that is the only field being problematic, I'd support a pull request that changes the db type for Description to Text. If you'd like to submit a pull request making that change, I'll happily review it.