{"categories":[{"label":"Database","url":"https://skillfed.io/packages/category/database/2"}],"enrichment":{"capability":"django-pgtrigger lets you define PostgreSQL triggers declaratively on Django models, enabling database-level enforcement of constraints, state transitions, and data operations without application code.","skillfed_tags":["postgres-triggers","database-constraints","django-integration"],"use_cases":["Prevent deletion of active records or enforce soft-delete behavior at the database level.","Make specific model fields or entire models read-only after creation without application-layer checks.","Enforce state transitions (e.g., workflow statuses) so invalid transitions are rejected by the database.","Automatically update search vectors or denormalized columns whenever source data changes.","Ensure official interfaces are used (e.g., force User.objects.create_user over User.objects.create).","Track or snapshot model changes for audit logs or versioning without signal handlers."],"what_it_does":"django-pgtrigger is a Django integration layer for PostgreSQL triggers. It lets you declare triggers as Python objects in your model's Meta class\u2014such as Protect, ReadOnly, SoftDelete, or FSM\u2014and have them automatically created and managed through Django migrations. Instead of writing raw SQL or relying on Django signals and application logic, you define what should happen at the database level when rows are inserted, updated, or deleted, with optional conditions based on old and new row values.\n\nThe package handles the translation from Python trigger definitions to SQL, manages migrations, and provides utilities like pgtrigger.Q and pgtrigger.F to express row conditions without raw SQL. It supports Python 3.10\u20133.14 and Django 4.2\u20136.0, and requires PostgreSQL as the database backend. Most use cases avoid custom SQL entirely, though the package allows it for complex scenarios.","worth_installing":"Yes, if you use PostgreSQL and Django together. The package is well-maintained, has no known vulnerabilities, and solves real problems\u2014constraints and state enforcement\u2014more reliably at the database level than in application code. The aging maintenance status is not a blocker; the repository is active and the package is stable. Install it when you need database-level triggers; skip it if you use a different database backend."},"id":"django-pgtrigger","links":{"html":"https://skillfed.io/packages/django-pgtrigger","md":"https://skillfed.io/packages/django-pgtrigger.md","pypi":"https://pypi.org/project/django-pgtrigger/"},"maintenance":{"status":"aging"},"meta":{"latest_release":"2025-12-04","license_spdx":null,"license_treatment":"permissive","name":"django-pgtrigger","python_support":"supports_current","summary":"Postgres trigger support integrated with Django models."},"popularity":{"monthly_downloads":1525527,"position":3815,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"4.17.0"}
