![]() 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/domains/soundstudiopro.com/public_html/ |
<?php
require_once 'config/database.php';
try {
$pdo = getDBConnection();
// Create sales table
$pdo->exec("CREATE TABLE IF NOT EXISTS sales (
id INT AUTO_INCREMENT PRIMARY KEY,
track_id INT NOT NULL,
buyer_id INT NOT NULL,
artist_id INT NOT NULL,
amount DECIMAL(10, 2) NOT NULL,
revenue_recipient VARCHAR(20) DEFAULT 'artist',
recipient_id INT,
is_free_user_track BOOLEAN DEFAULT FALSE,
quantity INT DEFAULT 1,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)");
// Create user_library table
$pdo->exec("CREATE TABLE IF NOT EXISTS user_library (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
track_id INT NOT NULL,
purchase_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY unique_library_item (user_id, track_id)
)");
// Create track_plays table
$pdo->exec("CREATE TABLE IF NOT EXISTS track_plays (
id INT AUTO_INCREMENT PRIMARY KEY,
track_id INT NOT NULL,
user_id INT,
played_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)");
// Create track_views table
$pdo->exec("CREATE TABLE IF NOT EXISTS track_views (
id INT AUTO_INCREMENT PRIMARY KEY,
track_id INT NOT NULL,
user_id INT,
viewed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)");
echo "✅ ALL TABLES CREATED SUCCESSFULLY!\n";
echo "Artist dashboard should work now.\n";
} catch (Exception $e) {
echo "❌ Error: " . $e->getMessage() . "\n";
}
?>