36780-vm/db/migration_products.php
Flatlogic Bot 6859a96e73 v2
2025-12-09 09:59:27 +00:00

16 lines
718 B
PHP

<?php
require_once 'config.php';
try {
$pdo = db();
$sql = "CREATE TABLE IF NOT EXISTS `products` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `price` decimal(10,2) NOT NULL, `duration` varchar(255) NOT NULL, `description` text NOT NULL, `features` text DEFAULT NULL, `thumbnail_url` varchar(255) DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
$pdo->exec($sql);
echo "Table 'products' created successfully.";
} catch (PDOException $e) {
die("DB ERROR: ". $e->getMessage());
}