Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-791

[GH-514] [DBAL-789] Fix default values for TEXT/BLOB column type on MySQL

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      This issue is created automatically through a Github pull request on behalf of deeky666:

      Url: https://github.com/doctrine/dbal/pull/514

      Message:

      MySQL does not support default values for `TEXT` and `BLOB` type columns. This causes `CREATE TABLE` statements to fail if a default value is supplied for those column types:

      ```sql
      Doctrine\DBAL\DBALException: An exception occurred while executing 'CREATE TABLE text_blob_default_value (def_text LONGTEXT DEFAULT 'def' NOT NULL, def_text_null LONGTEXT DEFAULT 'def', def_blob LONGBLOB DEFAULT 'def' NOT NULL, def_blob_null LONGBLOB DEFAULT 'def') DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB':

      SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB/TEXT column 'def_text' can't have a default value
      ```

      Additionally useless `ALTER TABLE` statements are created for those mappings with the schema tool because online and offline schema differ for those column types concerning default values:

      ```sql
      ALTER TABLE creative CHANGE filename filename LONGTEXT DEFAULT '' NOT NULL;
      ```

        Activity

        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-514] was closed:
        https://github.com/doctrine/dbal/pull/514

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-514] was closed: https://github.com/doctrine/dbal/pull/514

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Doctrine Bot
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: