feat(db): production database package without the dev login
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
7ba427ad44
commit
9fd801a1f5
7 files changed
+6461
-2
No files matched your search
@@ -0,0 +1,14 @@
|
||||
-- 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 <ADMIN_EMAIL> with the administrator's email and <BCRYPT_HASH> 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, '<ADMIN_EMAIL>', b'1', 'Admin', '<BCRYPT_HASH>', 'admin', 5, 1,
|
||||
'N', 'Y', 'A', 'setup', NOW(), 'setup', 1);
|
||||
INSERT INTO `users_roles` (`user_id`, `role_id`) VALUES (1, 1);
|
||||
Reference in new issue
Block a user