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

Fix down() for MakeSettingsValueNullable migration. #4838

Merged
merged 2 commits into from
Apr 14, 2020

Conversation

likemusic
Copy link
Contributor

If settings already contains null values, they should be converted to empty strings before altering table.

To prevent:

   Illuminate\Database\QueryException  : SQLSTATE[22004]: Null value not allowed: 1138 Invalid use of NULL value (SQL: ALTER TABLE settings CHANGE value value TEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`)

  at /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
    665|         // If an exception occurs when attempting to run a query, we'll format the error
    666|         // message to include the bindings with SQL, which will make this exception a
    667|         // lot more helpful to the developer instead of just the database's errors.
    668|         catch (Exception $e) {
  > 669|             throw new QueryException(
    670|                 $query, $this->prepareBindings($bindings), $e
    671|             );
    672|         }
    673|

  Exception trace:

  1   Doctrine\DBAL\Driver\PDOException::("SQLSTATE[22004]: Null value not allowed: 1138 Invalid use of NULL value")
      /var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:123

  2   PDOException::("SQLSTATE[22004]: Null value not allowed: 1138 Invalid use of NULL value")
      /var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:121

  Please use the argument -v to see more details.

@codecov
Copy link

codecov bot commented Mar 25, 2020

Codecov Report

Merging #4838 into 1.4 will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##                1.4    #4838   +/-   ##
=========================================
  Coverage     62.93%   62.93%           
  Complexity     1373     1373           
=========================================
  Files           194      194           
  Lines          3996     3996           
=========================================
  Hits           2515     2515           
  Misses         1481     1481           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update afea534...dfc2251. Read the comment docs.

@fletch3555 fletch3555 merged commit f4e6775 into thedevdojo:1.4 Apr 14, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants