-- Quick setup script for SkyArtShop backend
-- Run with: psql -U skyartapp -d skyartshop -f quick-setup.sql

\echo 'Creating adminusers table...'
CREATE TABLE IF NOT EXISTS adminusers (
  id SERIAL PRIMARY KEY,
  email VARCHAR(255) UNIQUE NOT NULL,
  name VARCHAR(255) NOT NULL,
  passwordhash TEXT NOT NULL,
  role VARCHAR(50) DEFAULT 'admin',
  createdat TIMESTAMP DEFAULT NOW(),
  lastlogin TIMESTAMP
);

\echo 'Creating temporary admin user...'
-- Email: admin@skyartshop.com
-- Password: Admin123!
DELETE FROM adminusers WHERE email = 'admin@skyartshop.com';
INSERT INTO adminusers (email, name, passwordhash, role) VALUES 
('admin@skyartshop.com', 'Admin User', '$2b$10$vN9gE1VTxH3qH3qH3qH3qOqXZ5J8YqH3qH3qH3qH3qH3qH3qH3qH3u', 'superadmin');

\echo 'Verifying admin user...'
SELECT id, email, name, role, createdat FROM adminusers;

\echo ''
\echo '========================================='
\echo 'Setup Complete!'
\echo '========================================='
\echo 'Login credentials:'
\echo '  Email: admin@skyartshop.com'
\echo '  Password: Admin123!'
\echo '========================================='
