cycle / database

Database Abstraction Layer, Schema Introspection, Schema Generation, Query Builders
MIT License
54 stars 22 forks source link

🐛 Default value as array for json type #54

Closed roquie closed 10 months ago

roquie commented 2 years ago

No duplicates 🥲.

Database

No response

What happened?

A bug happened!

Array to string conversion in vendor/cycle/database/src/Schema/AbstractColumn.php:342

Why is not possible to set default value as array for json type? It's a good feature. Just add something like this:

if ($this->getAbstractType() === 'json') {
    return json_encode($this->defaultValue, JSON_THROW_ON_ERROR);
}

Version

database 2.0
PHP 8.1