![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/.cursor-server/data/User/History/-42dec09f/ |
<?php
require_once 'config/database.php';
echo "š Checking audio_variations table...\n\n";
$pdo = getDBConnection();
if (!$pdo) {
echo "ā Database connection failed\n";
exit;
}
// Check if table exists
$stmt = $pdo->query("SHOW TABLES LIKE 'audio_variations'");
if ($stmt->rowCount() > 0) {
echo "ā
audio_variations table exists\n";
// Check table structure
$stmt = $pdo->query("DESCRIBE audio_variations");
$columns = $stmt->fetchAll();
echo "š Table structure:\n";
foreach ($columns as $column) {
echo " - {$column['Field']}: {$column['Type']}\n";
}
// Check if there are any variations
$stmt = $pdo->query("SELECT COUNT(*) as total FROM audio_variations");
$count = $stmt->fetch();
echo "\nš Total variations: {$count['total']}\n";
} else {
echo "ā audio_variations table does not exist\n";
echo "š§ Creating audio_variations table...\n";
try {
$pdo->exec("
CREATE TABLE audio_variations (
id INT AUTO_INCREMENT PRIMARY KEY,
track_id INT NOT NULL,
variation_index INT NOT NULL,
audio_url TEXT NOT NULL,
duration INT DEFAULT 30,
title VARCHAR(255),
tags TEXT,
image_url TEXT,
source_audio_url TEXT,
metadata JSON,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (track_id) REFERENCES music_tracks(id) ON DELETE CASCADE,
UNIQUE KEY unique_variation (track_id, variation_index)
)
");
echo "ā
audio_variations table created successfully\n";
// Add some sample variations for testing
echo "š§ Adding sample variations for testing...\n";
// Get a sample track
$stmt = $pdo->query("SELECT id FROM music_tracks LIMIT 1");
$track = $stmt->fetch();
if ($track) {
$trackId = $track['id'];
// Insert sample variations
$stmt = $pdo->prepare("
INSERT INTO audio_variations (track_id, variation_index, audio_url, duration, title, tags)
VALUES (?, ?, ?, ?, ?, ?)
");
$variations = [
[1, '/sample1.mp3', 180, 'Variation 1', 'electronic,dance,upbeat'],
[2, '/sample2.mp3', 175, 'Variation 2', 'electronic,dance,chill']
];
foreach ($variations as $variation) {
$stmt->execute([$trackId, $variation[0], $variation[1], $variation[2], $variation[3], $variation[4]]);
}
echo "ā
Added sample variations for track ID: $trackId\n";
} else {
echo "ā ļø No tracks found to add sample variations\n";
}
} catch (Exception $e) {
echo "ā Error creating table: " . $e->getMessage() . "\n";
}
}
echo "\nšÆ Check complete!\n";
?>