<?php
$host = "localhost";
$username = "tnyowsjv_lamile";
$password = "2wTFC65&*9masqx6%@r4";
$database = "tnyowsjv_crudalamile";

// Connect to MySQL
$conn = new mysqli($host, $username, $password, $database);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// SQL to create table stock_adjustments
$sql = "CREATE TABLE stock_adjustments (
    id INT NOT NULL AUTO_INCREMENT,
    product_id INT NOT NULL,
    adjust_qty INT NOT NULL,
    reason VARCHAR(255),
    adjust_date DATETIME DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    FOREIGN KEY (product_id) REFERENCES products_table(product_id)
)";

if ($conn->query($sql) === TRUE) {
    echo "<p style='color:green;'>Table created successfully!</p>";
} else {
    echo "<p style='color:red;'>Error creating table: " . $conn->error . "</p>";
}

$conn->close();
?>
