32 lines
1.1 KiB
PHP
32 lines
1.1 KiB
PHP
<?php
|
|
require_once __DIR__ . '/config.php';
|
|
|
|
try {
|
|
$pdo = db();
|
|
// Check if plans already exist
|
|
$stmt = $pdo->query("SELECT COUNT(*) FROM plans");
|
|
if ($stmt->fetchColumn() > 0) {
|
|
echo "Plans table is already seeded." . PHP_EOL;
|
|
exit;
|
|
}
|
|
|
|
// Insert the "Starter" credit pack
|
|
// IMPORTANT: Replace 'price_12345' with your actual Stripe Price ID for the credit pack
|
|
$starterPack = [
|
|
'name' => 'Starter Pack',
|
|
'stripe_price_id' => 'price_1PeP3QRpH4kRz8A8e25a25fA', // Placeholder - REPLACE THIS
|
|
'price' => 5.00,
|
|
'credits_awarded' => 50,
|
|
'features' => json_encode(['50 analysis credits', 'Standard support']),
|
|
];
|
|
|
|
$sql = "INSERT INTO plans (name, stripe_price_id, price, credits_awarded, features) VALUES (:name, :stripe_price_id, :price, :credits_awarded, :features)";
|
|
$stmt = $pdo->prepare($sql);
|
|
$stmt->execute($starterPack);
|
|
|
|
echo "Successfully seeded the 'plans' table with the Starter Pack." . PHP_EOL;
|
|
|
|
} catch (PDOException $e) {
|
|
die("Database error: " . $e->getMessage());
|
|
}
|