-- Database schema for Booknap user authentication
-- Run this in your PostgreSQL database

-- Create users table
CREATE TABLE IF NOT EXISTS users (
    id SERIAL PRIMARY KEY,
    full_name VARCHAR(255) NOT NULL,
    email VARCHAR(255) UNIQUE NOT NULL,
    password VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Create index on email for faster lookups
CREATE INDEX IF NOT EXISTS idx_users_email ON users(email);

-- Insert a sample user for testing (password: test123)
-- INSERT INTO users (full_name, email, password) VALUES ('Test User', 'test@example.com', 'test123');

-- Note: In production, passwords should be hashed using bcrypt or similar
-- The current implementation stores plaintext passwords for demo purposes only
