36896-vm/db/migrations/001_create_streams_table.php
Flatlogic Bot 48cd368984 cloud
2025-12-12 17:05:57 +00:00

23 lines
790 B
PHP

<?php
require_once __DIR__ . '/../config.php';
try {
$pdo = db();
$sql = "
CREATE TABLE IF NOT EXISTS streams (
id INT AUTO_INCREMENT PRIMARY KEY,
url VARCHAR(2048) NOT NULL,
filename VARCHAR(255) NOT NULL,
dropbox_token VARCHAR(255) NULL,
status ENUM('pending', 'downloading', 'converting', 'uploading', 'completed', 'error') NOT NULL DEFAULT 'pending',
error_message TEXT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=INNODB;
";
$pdo->exec($sql);
echo "Tabela 'streams' criada com sucesso ou já existente." . PHP_EOL;
} catch (PDOException $e) {
die("Erro ao criar tabela: " . $e->getMessage());
}