Automatisches Ausschalten der Drucker nach Ablauf der Auftragszeit
- Verbesserte Funktion check-jobs für automatische Abschaltung - Implentierung von Warteschlange für besetzte Drucker - Neues Datenbank-Feld 'waiting_approval' für Druckaufträge - Neuer API-Endpunkt '/api/jobs/<job_id>/approve' zur Freischaltung - Verbessertes Logging für Debugging-Zwecke 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
42
backend/migrations/versions/add_waiting_approval.py
Normal file
42
backend/migrations/versions/add_waiting_approval.py
Normal file
@ -0,0 +1,42 @@
|
||||
"""Add waiting_approval column to job table
|
||||
|
||||
Revision ID: add_waiting_approval
|
||||
Revises: af3faaa3844c
|
||||
Create Date: 2025-03-12 14:00:00.000000
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'add_waiting_approval'
|
||||
down_revision = 'af3faaa3844c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# Füge die neue Spalte waiting_approval zur job-Tabelle hinzu
|
||||
with op.batch_alter_table('job', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('waiting_approval', sa.Integer(), server_default='0', nullable=False))
|
||||
|
||||
# SQLite-kompatible Migration für die print_job-Tabelle, falls diese existiert
|
||||
try:
|
||||
with op.batch_alter_table('print_job', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('waiting_approval', sa.Boolean(), server_default='0', nullable=False))
|
||||
except Exception as e:
|
||||
print(f"Migration für print_job-Tabelle übersprungen: {e}")
|
||||
|
||||
|
||||
def downgrade():
|
||||
# Entferne die waiting_approval-Spalte aus der job-Tabelle
|
||||
with op.batch_alter_table('job', schema=None) as batch_op:
|
||||
batch_op.drop_column('waiting_approval')
|
||||
|
||||
# SQLite-kompatible Migration für die print_job-Tabelle, falls diese existiert
|
||||
try:
|
||||
with op.batch_alter_table('print_job', schema=None) as batch_op:
|
||||
batch_op.drop_column('waiting_approval')
|
||||
except Exception as e:
|
||||
print(f"Downgrade für print_job-Tabelle übersprungen: {e}")
|
Reference in New Issue
Block a user