Page 1 of 1
UNIQUE key on the sus_login_name column
Posted: Tue Jul 12, 2022 4:42 am
by miasoft
For the zzzzsys_user table, after each update, I add a UNIQUE key on the sus_login_name column. I don't understand why this key is not set by default?
Re: UNIQUE key on the sus_login_name column
Posted: Tue Jul 12, 2022 5:12 am
by kev1n
Do you mean a unique constraint?
Why would you want to add it?
All changes to zzzz-tables are overwritten with an update.
Re: UNIQUE key on the sus_login_name column
Posted: Tue Jul 12, 2022 6:37 am
by miasoft
kev1n wrote: ↑Tue Jul 12, 2022 5:12 am
Do you mean a unique constraint?
Why would you want to add it?
How is the uniqueness of sus_login_name checked? MySql rules or PHP-code? UNIQUE key needed for non-NUBuider programm (for me)
Re: UNIQUE key on the sus_login_name column
Posted: Tue Jul 12, 2022 7:47 am
by kev1n
Uniqueness is ensured by code.
I might be able to provide some post-update functionality that allows you to run scripts after each update.
Re: UNIQUE key on the sus_login_name column
Posted: Mon Jul 18, 2022 8:49 pm
by kev1n
Does that make sense?
Re: UNIQUE key on the sus_login_name column
Posted: Wed Jul 20, 2022 11:12 am
by miasoft
kev1n wrote: ↑Mon Jul 18, 2022 8:49 pm
Does that make sense?
It doesn't bother me

Re: UNIQUE key on the sus_login_name column
Posted: Wed Jul 20, 2022 11:36 am
by kev1n
There's now a possibility to run scripts after each update.
If the Procedure called
nuAfterUpdate function exists, it will be run after an update.
Example:
nuAfterUpdate.png
Code: Select all
// Add a unique key to zzzzsys_user.sus_login_name
nuRunQuery(" ALTER TABLE `zzzzsys_user` ADD UNIQUE(`sus_login_name`) ";
Re: UNIQUE key on the sus_login_name column
Posted: Wed Jul 20, 2022 12:32 pm
by miasoft
Thanks! I updated from Github. All work fine.
It's typo in script. Corrected:
Code: Select all
nuRunQuery(" ALTER TABLE `zzzzsys_user` ADD UNIQUE(`sus_login_name`) ");