
-- Create the users table
CREATE TABLE users (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(30) NOT NULL,
    password VARCHAR(255) NOT NULL,  -- Store hashed password
    email VARCHAR(50),
    created_at TIMESTAMP
);

-- Create the expenses table
CREATE TABLE expenses (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    amount DECIMAL(10, 2) NOT NULL,
    category VARCHAR(30) NOT NULL,
    description TEXT,
    created_at TIMESTAMP
);

-- Create the budgets table
CREATE TABLE budgets (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    category VARCHAR(30) NOT NULL,
    budget_amount DECIMAL(10, 2) NOT NULL,
    spent_amount DECIMAL(10, 2) DEFAULT 0,
    created_at TIMESTAMP
);
