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

42 lines
1.5 KiB
PHP

<?php
require_once 'config.php';
try {
$pdo = db();
// Create affirmations table
$pdo->exec("CREATE TABLE IF NOT EXISTS affirmations (
id INT AUTO_INCREMENT PRIMARY KEY,
theme VARCHAR(255) NOT NULL,
level VARCHAR(50) NOT NULL DEFAULT 'beginner',
affirmation_text TEXT NOT NULL
)");
// Clear existing affirmations to avoid duplicates on re-run
$pdo->exec("TRUNCATE TABLE affirmations");
$affirmations = [
'gratitude' => 'I am grateful for the abundance in my life.',
'letting-go' => 'I release what no longer serves me.',
'self-love' => 'I love and accept myself unconditionally.',
'forgiveness' => 'I forgive myself and others, freeing myself from the past.',
'abundance' => 'I am a magnet for success and good fortune.',
'clarity' => 'My mind is clear and my path is unfolding perfectly.',
'healing' => 'I am healing, whole, and strong.',
'resilience' => 'I bounce back from challenges with ease.',
'joy' => 'I choose joy and find it in every moment.',
'peace' => 'I cultivate peace within and around me.'
];
$stmt = $pdo->prepare("INSERT INTO affirmations (theme, affirmation_text) VALUES (:theme, :affirmation_text)");
foreach ($affirmations as $theme => $text) {
$stmt->execute(['theme' => $theme, 'affirmation_text' => $text]);
}
echo "Database setup complete. 'affirmations' table created and seeded." . PHP_EOL;
} catch (PDOException $e) {
die("Database setup failed: " . $e->getMessage());
}