CREATE DATABASE IF NOT EXISTS hitnrun;

USE hitnrun;

CREATE TABLE IF NOT EXISTS users (
    uid INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(50) NOT NULL,
    password VARCHAR(255) NOT NULL,
    money INT NOT NULL DEFAULT 2500,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE users
ADD UNIQUE (username);

CREATE TABLE IF NOT EXISTS bets (
    uid int PRIMARY KEY,
    bet INT NOT NULL DEFAULT 0,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS wins (
    uid int PRIMARY KEY,
    win INT NOT NULL DEFAULT 0,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);