Added support for Streamdeck Pedal and updated UI to better fit the Packed UI style
This commit is contained in:
44
pirp/tools/migrate_deductions.php
Normal file
44
pirp/tools/migrate_deductions.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Migration: Erstellt journal_deduction_categories Tabelle für customizable Abzüge
|
||||
* Ausführen: php tools/migrate_deductions.php
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../src/config.php';
|
||||
require_once __DIR__ . '/../src/db.php';
|
||||
|
||||
$pdo = get_db();
|
||||
|
||||
echo "Migration: journal_deduction_categories\n";
|
||||
|
||||
try {
|
||||
// Prüfen ob Tabelle existiert
|
||||
$stmt = $pdo->query("SELECT to_regclass('public.journal_deduction_categories')");
|
||||
$exists = $stmt->fetchColumn();
|
||||
|
||||
if ($exists) {
|
||||
echo "Tabelle journal_deduction_categories existiert bereits.\n";
|
||||
} else {
|
||||
// Tabelle erstellen
|
||||
$pdo->exec("CREATE TABLE journal_deduction_categories (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(100) NOT NULL,
|
||||
sort_order INTEGER DEFAULT 0,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
)");
|
||||
echo "Tabelle journal_deduction_categories erstellt.\n";
|
||||
|
||||
// Standard-Abzüge einfügen
|
||||
$pdo->exec("INSERT INTO journal_deduction_categories (name, sort_order, is_active) VALUES
|
||||
('Skonto', 1, TRUE),
|
||||
('Lotto', 2, TRUE)
|
||||
");
|
||||
echo "Standard-Abzüge (Skonto, Lotto) eingefügt.\n";
|
||||
}
|
||||
|
||||
echo "Migration erfolgreich!\n";
|
||||
} catch (PDOException $e) {
|
||||
echo "Fehler: " . $e->getMessage() . "\n";
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user