LiveCloud Forums
Adding a new key to an existing table - Printable Version

+- LiveCloud Forums (https://forums.livecloud.io)
+-- Forum: General (https://forums.livecloud.io/forumdisplay.php?fid=1)
+--- Forum: General (https://forums.livecloud.io/forumdisplay.php?fid=3)
+--- Thread: Adding a new key to an existing table (/showthread.php?tid=30)



Adding a new key to an existing table - Jean2080 - 06-11-2019

I need to add a new key to an existing table.

1 - I tried to use the Add Key button in the Manager. I am able to add the name of the key but cannot find the way to save this new key so I could enter data into it after. Is there a button or a procedure I can use ?

2 - I tried adding a key with the code I found in you documentation using this code:
command cdb_addKeys pTable, pKeys

on mouseUp pButtonNumber

local tTable, tKeys

put "Subject" into tTable

put "Why" into tKeys

cdb_addKeys tTable,tKeys
end mouseUp

 I get the following message in the message Windows:
(2019-06-10 20:50:24.543): Error: Failed API Key Authentication

So I checked for A way to log as Developper or Administrator, but I found code that uses "user" but does not tell me with what to replace "user" whit to identify myself as Administrator.
 

on preOpenStack

    initializeCanelaDB

    get cdb_auth(pEmail,pPassword,"user")
end preOpenStack

So What is the way to identify myself as Administrator so I can pass a command to add a new Key ?




RE: Adding a new key to an existing table - efrain.c - 06-11-2019

Hi Jean,

"Users" are not allowed to add keys to tables. We will be improving our UAC so developers can customize what a user can do. If you are ok with your users having full access to your data model (delete project, delete tables, delete keys, add keys, etc) then you can call cdb_auth with "developer" instead of "user". pEmail and pPassword would be the email and password you use to login on LCM. If you don't want your users to have access to those APIs, then you can create a schemaless table. Users will be able to create records in a schemaless table with any key without having to add the key to the table.

Hope this helps!


RE: Adding a new key to an existing table SOLVED: - Jean2080 - 06-11-2019

I just tried using "developer" to add a key and it work fine. Merci, It's mean I can correct my table design and more tests.