generated from VLADIMIR/template
19 lines
546 B
SQL
19 lines
546 B
SQL
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.'
|