mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-19 07:33:18 +02:00
Add optional PostgreSQL database support
Bambuddy can now use an external PostgreSQL database via the DATABASE_URL environment variable. SQLite remains the default. Dialect-aware helpers handle upserts, PRAGMAs, FTS (FTS5 vs tsvector+GIN), backup/restore, and health checks. All migration blocks use savepoints to prevent Postgres transaction poisoning. Backups are always portable SQLite format regardless of backend. Cross-database restore imports SQLite backups into PostgreSQL with automatic boolean/datetime conversion, NOT NULL default filling, and FK constraint handling.
This commit is contained in:
@@ -15,7 +15,9 @@ class VirtualPrinter(Base):
|
||||
name: Mapped[str] = mapped_column(String(100), default="Bambuddy")
|
||||
enabled: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
mode: Mapped[str] = mapped_column(String(20), default="immediate") # immediate|review|print_queue|proxy
|
||||
auto_dispatch: Mapped[bool] = mapped_column(Boolean, default=True) # print_queue mode: auto-start or manual
|
||||
auto_dispatch: Mapped[bool] = mapped_column(
|
||||
Boolean, server_default="true"
|
||||
) # print_queue mode: auto-start or manual
|
||||
model: Mapped[str | None] = mapped_column(String(50), nullable=True) # SSDP model code (server mode)
|
||||
access_code: Mapped[str | None] = mapped_column(String(8), nullable=True) # 8 chars (server mode)
|
||||
target_printer_id: Mapped[int | None] = mapped_column(
|
||||
|
||||
Reference in New Issue
Block a user