Files
dog-trainer-x2zr8s/migrations/001_create_training_items_table.php
2026-04-05 03:07:30 +00:00

61 lines
1.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
$pdo->exec("
CREATE TABLE IF NOT EXISTS training_items (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT NULL,
sort_order INT NOT NULL DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)
");
// Seed default items if table is empty
$count = $pdo->query("SELECT COUNT(*) FROM training_items")->fetchColumn();
if ($count == 0) {
$items = [
[
'Minute 03: Calm training',
"Sit down somewhere boring.\n\n
&bull; Ignore her completely\n
&bull; The second she settles even a little (lays down, sighs, pauses) → quietly say “yes” and give a treat\n
&bull; No excitement, no talking\n\n
Goal: teach her that calm = reward",
1
],
[
'Minute 36: Leash pressure game',
"Inside the house.\n\n
&bull; Put leash on\n
&bull; Apply gentle pressure (not a yank, just steady)\n
&bull; The moment she moves toward you → “yes” + treat\n\n
Goal: pressure means move back, not fight it",
2
],
[
'Minute 68: Micro walk practice',
"Inside or just outside your door.\n\n
&bull; Take a few steps\n
&bull; If leash tightens → stop immediately\n
&bull; When she gives slack → move again\n\n
This is practice, not exercise",
3
],
[
'Minute 810: Separation practice',
"Step away briefly.\n\n
&bull; Step out of sight\n
&bull; Count to 3\n
&bull; Come back before she reacts\n
&bull; Stay calm, no excitement when returning\n\n
Repeat 510 times\n\n
Goal: leaving and returning is no big deal",
4
],
];
$stmt = $pdo->prepare("INSERT INTO training_items (title, description, sort_order) VALUES (?, ?, ?)");
foreach ($items as $item) {
$stmt->execute($item);
}
}