bfinlay / laravel-excel-seeder

Seed your database with Laravel using Excel and CSV files
Other
38 stars 8 forks source link

MariaDB support for null in parser #27

Closed thanasisxan closed 1 month ago

thanasisxan commented 3 months ago

When using MariaDB 10 and define a parser for a specific field that returns null under certain conditions, the row is populated with 'NULL' as string literal in the table. The parser looks like this:

$set->parsers = [
            'image_path' => function ($value) {
                return $value == 0 ? null : strtoupper($value).'.jpg';
            },
]

In MySQL 8 and PostgreSQL 15 it works as expected and database NULL is inserted.

bfinlay commented 3 months ago

I am looking into this.

I need to add some more test cases for null.

bfinlay commented 1 month ago

This issue is fixed in release 3.4.1.

Let me know if it worked for you.

Closing issue as complete, but feel free to add comments if something is still not working.