"""Migration 2026-05-30: projekt_datei.extern_url einfuehren. Erlaubt externe Links als "Datei" (GitHub-Repo, MakerWorld, Printables, gehostete grosse Druckdateien) statt alles als BLOB in die DB zu pressen. - extern_url gesetzt -> inhalt BLOB ist NULL, art = 'link' - extern_url NULL -> klassischer Upload (BLOB) Idempotent. """ import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) from database import get_db def main(): conn = get_db() spalten = {row["name"] for row in conn.execute("PRAGMA table_info(projekt_datei)")} if "extern_url" in spalten: conn.close() print("[migration] projekt_datei.extern_url existiert bereits.") return conn.execute("ALTER TABLE projekt_datei ADD COLUMN extern_url TEXT") conn.commit() conn.close() print("[migration] projekt_datei.extern_url ergaenzt.") if __name__ == "__main__": main()