42 lines
1.6 KiB
SQL
Executable File
42 lines
1.6 KiB
SQL
Executable File
CREATE TABLE IF NOT EXISTS users (
|
|
id SERIAL PRIMARY KEY,
|
|
username VARCHAR(100) UNIQUE NOT NULL,
|
|
password_hash TEXT NOT NULL,
|
|
is_admin BOOLEAN DEFAULT FALSE,
|
|
created_at TIMESTAMP DEFAULT NOW()
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS webpages (
|
|
id SERIAL PRIMARY KEY,
|
|
name VARCHAR(200) NOT NULL,
|
|
url TEXT NOT NULL,
|
|
description TEXT DEFAULT '',
|
|
icon VARCHAR(10) DEFAULT '🌐',
|
|
created_at TIMESTAMP DEFAULT NOW()
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS user_webpages (
|
|
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
|
|
webpage_id INTEGER REFERENCES webpages(id) ON DELETE CASCADE,
|
|
PRIMARY KEY (user_id, webpage_id)
|
|
);
|
|
|
|
-- Default admin account (password: admin1234)
|
|
INSERT INTO users (username, password_hash, is_admin)
|
|
VALUES ('admin', '$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/LewKyNiAYMxRmfvym', TRUE)
|
|
ON CONFLICT (username) DO NOTHING;
|
|
|
|
-- Default test user (password: user1234)
|
|
INSERT INTO users (username, password_hash, is_admin)
|
|
VALUES ('user1', '$2b$12$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', FALSE)
|
|
ON CONFLICT (username) DO NOTHING;
|
|
|
|
-- Sample webpages
|
|
INSERT INTO webpages (name, url, description, icon) VALUES
|
|
('Google', 'https://www.google.com', '구글 검색 엔진', '🔍'),
|
|
('GitHub', 'https://github.com', '소스코드 저장소', '🐙'),
|
|
('Kubernetes Dashboard', 'http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/', '쿠버네티스 대시보드', '☸️'),
|
|
('Grafana', 'http://grafana.monitoring.svc:3000', '모니터링 대시보드', '📊'),
|
|
('Notion', 'https://notion.so', '문서 협업 툴', '📝')
|
|
ON CONFLICT DO NOTHING;
|