I want to create One table model using declarative schema having one column type as json.
< ?xml version="1.0" ?>
I captured following error:-
/var/www/public_html/vendor/magento/framework/Setup/Declaration/Schema/SchemaConfig.php:82:
string(412) "The XML in file "/var/www/public_html/app/code/Levosoft/Partpicker/etc/db_schema.xml" is invalid:
Element 'column', attribute '{http://www.w3.org/2001/XMLSchema-instance}type': The QName value 'json' of the xsi:type attribute does not resolve to a type definition.
Line: 9
The error shows that yet magento had not added support for json type.
Any proper work around? Other then I `alter type later via sql`
fmi:
To check declarative schema is working properly you have to run following command:
php bin/magento setup:db-declaration:generate-whitelist --module-name=Textmimedia_Partpicker
If no error in script it will generate whitelist file else no error will be displayed & file not generated.
To check its error you have to update following code in core file (/public_html/vendor/magento/framework/Setup/Declaration/Schema/SchemaConfig.php
) for testing:
public function getDeclarationConfig()
{
try {
$schema = $this->schemaFactory->create();
$data = $this->readerComposite->read(FileResolverByModule::ALL_MODULES);
$this->declarativeSchemaBuilder->addTablesData($data['table']);
$schema = $this->declarativeSchemaBuilder->build($schema);
return $schema;
} catch (Exception $e) {
var_dump($e->getMessage());exit;
}
}