-- Production package for the DBA. Creates the first back-office administrator. -- Run after 00 to 03, on an empty `user` table (this row takes id 1). -- Replace with the administrator's email and with a bcrypt hash of a password you choose. -- To make the hash without the password reaching shell history (read -rs does not echo it): -- read -rs PW; printf '%s' "$PW" | docker run --rm -i httpd:2.4-alpine htpasswd -inBC 10 "" | tr -d ':\n'; unset PW -- (the $2y$ prefix it produces works as is). Afterwards, SELECT LENGTH(password) FROM `user` WHERE id = 1 -- must return 60; anything else means the placeholder was not replaced. -- login = 'N' forces this administrator to change the password at first sign-in. USE `service-system`; INSERT INTO `user` (`id`, `email`, `enabled`, `name`, `password`, `username`, `groupid`, `branchid`, `login`, `status`, `type`, `create_by`, `create_date`, `done_by`, `company_id`) VALUES (1, '', b'1', 'Admin', '', 'admin', 5, 1, 'N', 'Y', 'A', 'setup', NOW(), 'setup', 1); INSERT INTO `users_roles` (`user_id`, `role_id`) VALUES (1, 1);