fix several bugs

This commit is contained in:
DioCrafts
2025-04-10 01:43:25 +02:00
parent 9e73d50a44
commit 5d67bc4d84
19 changed files with 335 additions and 113 deletions
+46 -32
View File
@@ -1,35 +1,49 @@
-- Migration 002: Default Users
-- Create admin user (password: Admin123!)
INSERT INTO auth.users (
id,
username,
email,
password_hash,
role,
storage_quota_bytes
) VALUES (
'00000000-0000-0000-0000-000000000000',
'admin',
'admin@oxicloud.local',
'$argon2id$v=19$m=65536,t=3,p=4$c2FsdHNhbHRzYWx0c2FsdA$H3VxE8LL2qPT31DM3loTg6D+O4MSc2sD7GjlQ5h7Jkw', -- Admin123!
'admin',
107374182400 -- 100GB for admin
) ON CONFLICT (id) DO NOTHING;
-- Check if admin user already exists before creating it
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM auth.users WHERE username = 'admin') THEN
-- Create admin user (password: Admin123!)
INSERT INTO auth.users (
id,
username,
email,
password_hash,
role,
storage_quota_bytes
) VALUES (
'00000000-0000-0000-0000-000000000000',
'admin',
'admin@oxicloud.local',
'$argon2id$v=19$m=65536,t=3,p=4$c2FsdHNhbHRzYWx0c2FsdA$H3VxE8LL2qPT31DM3loTg6D+O4MSc2sD7GjlQ5h7Jkw', -- Admin123!
'admin',
107374182400 -- 100GB for admin
);
END IF;
END;
$$;
-- Create test user (password: test123)
INSERT INTO auth.users (
id,
username,
email,
password_hash,
role,
storage_quota_bytes
) VALUES (
'11111111-1111-1111-1111-111111111111',
'test',
'test@oxicloud.local',
'$argon2id$v=19$m=65536,t=3,p=4$c2FsdHNhbHRzYWx0c2FsdA$ZG17Z7SFKhs9zWYbuk08CkHpyiznnZapYnxN5Vi62R4', -- test123
'user',
10737418240 -- 10GB for test user
) ON CONFLICT (id) DO NOTHING;
-- Check if test user already exists before creating it
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM auth.users WHERE username = 'test') THEN
-- Create test user (password: test123)
INSERT INTO auth.users (
id,
username,
email,
password_hash,
role,
storage_quota_bytes
) VALUES (
'11111111-1111-1111-1111-111111111111',
'test',
'test@oxicloud.local',
'$argon2id$v=19$m=65536,t=3,p=4$c2FsdHNhbHRzYWx0c2FsdA$ZG17Z7SFKhs9zWYbuk08CkHpyiznnZapYnxN5Vi62R4', -- test123
'user',
10737418240 -- 10GB for test user
);
END IF;
END;
$$;