Summary
This migration update adds data cleanup logic to the down() method to ensure database integrity when rolling back the nullable constraint on the meta_value column in the app_metas table.
Changes
- Added
use Illuminate\Support\Facades\DB;import to support direct database operations - Added a data migration step in the
down()method that converts any nullmeta_valueentries to empty strings before removing the nullable constraint
Implementation Details
When rolling back this migration, the schema change attempts to convert meta_value from nullable to non-nullable. However, if any rows contain null values, this would fail. The new logic preemptively converts all null values to empty strings, ensuring the rollback can complete successfully.
This follows the package convention that meta_value is always stored as a string in the database, with the value accessor handling type restoration.
https://claude.ai/code/session_01Do5SwCFS4SihacyuMcCrgm
What's Changed
Full Changelog: 2.4.0...2.4.1