tarantool-php/mapper

Bug with nullable index part

chelsEg opened this issue · 1 comments

Hello!

I reproduce bug with nullable field who used in index.

My code for creating space:

$this->tarantoolMapper->getSchema()->createSpace('example', [
    'if_not_exists' => true,
    'engine'        => 'memtx',
    'properties' => [
        'id'         => 'unsigned',
        'field1'     => 'string',
        'field2'     => 'string',
        'field3'     => 'unsigned',
        'field4'     => 'unsigned',
        'field5'     => 'unsigned',
        'field6'     => 'unsigned',
    ],
])
->setPropertyNullable('field5')
->addIndex([
    'fields'        => 'id',
    'if_not_exists' => true,
    'sequence'      => true,
    'name'          => 'index_1'
])
->addIndex([
    'fields'        => ['field2', 'field5'],
    'unique'        => false,
    'if_not_exists' => true,
    'name'          => 'index_2',
]);

But, in createIndex function we have some interesting case.

After that space field who define like nullable, stay not nullable.

use v4.6.12
define nullable index fields like:

->addIndex([
    'fields'        => ['field2', [ 'property' => 'field5', 'is_nullable' => true ]],
    'unique'        => false,
    'if_not_exists' => true,
    'name'          => 'index_2',
]);