[tarantool-patches] Re: [PATCH 2/3] Allow use existing user

Alex Khatskevich avkhatskevich at tarantool.org
Tue Jun 26 00:55:55 MSK 2018


>> @@ -138,11 +138,19 @@ end
>> --------------------------------------------------------------------------------
>>   -- Schema
>> --------------------------------------------------------------------------------
>> +local function create_user(username, password)
>> +    box.schema.user.create(username, {
>> +        password = password,
>> +        if_not_exists = true,
>> +    })
>> +    -- Replication may has not been granted, if user exists.
>> +    box.schema.user.grant(username, 'replication', nil, nil,
>> +                          {if_not_exists = true})
>> +end
>>     local function storage_schema_v1(username, password)
>>       log.info("Initializing schema")
>> -    box.schema.user.create(username, {password = password})
>> -    box.schema.user.grant(username, 'replication')
>> +    create_user(username, password)
>
> 1. Please, just inline this function. It is not needed anywhere else
> and is extremely simple.
>
done




More information about the Tarantool-patches mailing list