add dev user script

This commit is contained in:
2026-09-21 18:54:32 +07:00
parent 88f48731a6
commit b1e7a78032
3 changed files with 46 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
CREATE EXTENSION IF NOT EXISTS pgcrypto;
INSERT INTO users (username, email, password_hash, roles, is_active)
VALUES (
:'dev_username',
:'dev_email',
crypt(:'dev_password', gen_salt('bf')),
'["admin", "author", "organizer", "user"]'::jsonb,
TRUE
)
ON CONFLICT (email) DO UPDATE
SET username = EXCLUDED.username,
password_hash = EXCLUDED.password_hash,
roles = EXCLUDED.roles,
is_active = TRUE;
\echo 'Development user is ready.'
\echo 'Login with the DEV_USER_EMAIL and DEV_USER_PASSWORD values passed to make.'