-- database/schema.sql - Schéma de base de données
CREATE DATABASE IF NOT EXISTS ecommerce;
USE ecommerce;

CREATE TABLE IF NOT EXISTS produits (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nom VARCHAR(255) NOT NULL,
    description TEXT,
    prix DECIMAL(10,2) NOT NULL,
    stock INT DEFAULT 0,
    actif TINYINT(1) DEFAULT 1,
    image VARCHAR(255)
);

CREATE TABLE IF NOT EXISTS commandes (
    id INT AUTO_INCREMENT PRIMARY KEY,
    session_id VARCHAR(255),
    montant DECIMAL(10,2),
    statut ENUM('pending', 'paid', 'shipped') DEFAULT 'pending',
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);