36776-vm/db/setup_subscriptions.php
Flatlogic Bot 3be446013d Initialv1
2025-12-09 00:59:40 +00:00

23 lines
765 B
PHP

<?php
require_once 'config.php';
try {
$pdo = db();
$sql = "
CREATE TABLE IF NOT EXISTS `subscriptions` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`user_id` INT NOT NULL,
`stripe_subscription_id` VARCHAR(255) NOT NULL,
`plan` VARCHAR(50) NOT NULL,
`status` VARCHAR(50) NOT NULL,
`start_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`end_date` TIMESTAMP NULL DEFAULT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
";
$pdo->exec($sql);
echo "Table 'subscriptions' created successfully.";
} catch (PDOException $e) {
die("Could not create table 'subscriptions': " . $e->getMessage());
}
?>