36692-vm/db/migrations/004_seed_services_table.php
2025-12-05 19:48:45 +00:00

46 lines
1.2 KiB
PHP

<?php
require_once __DIR__ . '/../../db/config.php';
try {
$pdo = db();
$services = [
[
'name' => 'Basic Plan',
'description' => 'Access to basic features.',
'price' => 9.99,
'billing_cycle' => 'monthly'
],
[
'name' => 'Pro Plan',
'description' => 'Access to all features and priority support.',
'price' => 29.99,
'billing_cycle' => 'monthly'
],
[
'name' => 'Annual Basic Plan',
'description' => 'One year of the Basic Plan.',
'price' => 99.99,
'billing_cycle' => 'yearly'
],
[
'name' => 'Annual Pro Plan',
'description' => 'One year of the Pro Plan.',
'price' => 299.99,
'billing_cycle' => 'yearly'
]
];
$sql = "INSERT INTO services (name, description, price, billing_cycle) VALUES (:name, :description, :price, :billing_cycle)";
$stmt = $pdo->prepare($sql);
foreach ($services as $service) {
$stmt->execute($service);
}
echo "Services seeded successfully." . PHP_EOL;
} catch (PDOException $e) {
die("Could not seed services: " . $e->getMessage());
}