lunarphp / lunar

An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Home Page:https://lunarphp.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Migration failure when upgrading to 1.0 - Postgresql

jstoks opened this issue · comments

  • Lunar version: 1.0.0-alpha29
  • Laravel Version: 10.48.15
  • PHP Version: 8.3.8
  • Database Driver & Version: Postgresql 15.6

Expected Behaviour:

  • Running migrations during an upgrade should not fail.

Actual Behaviour:

  • core/database/migrations/2024_01_11_100000_add_description_to_attributes_table.php fails with a QueryException
QueryException
 Illuminate\Database\QueryException 

  SQLSTATE[23502]: Not null violation: 7 ERROR:  column "description" of relation "lunar_attributes" contains null values (Connection: pgsql, SQL: alter table "lunar_attributes" add column "description" json not null)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:829
    825▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    826▕                 );
    827▕             }
    828▕ 
  ➜ 829▕             throw new QueryException(
    830▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    831▕             );
    832▕         }
    833▕     }

      +10 vendor frames 

  11  database/migrations/2024_01_11_100000_add_description_to_attributes_table.php:12
      Illuminate\Support\Facades\Facade::__callStatic()
      +25 vendor frames 

  37  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

Steps To Reproduce:

  • Use Postgresql or other DB that doesn't default columns to null.
  • Have records in the attributes table before running migration.
  • Execute migrations