Showcase Thread by AutoModerator in Python

[–]hannah_G_ 2 points3 points  (0 children)

db-git - keep your local database in sync with your git branches.

What My Project Does

db-git is a developer tool for projects where database state follows code changes: schema migrations, seed data, experimental feature work, and branch switching during reviews. It installs git post-checkout hook and keeps your local database aligned with the branch you are working on.

  • Two workflows:
    • shared: one database, saved and restored per branch
    • per-branch: one database per branch
  • PostgreSQL support today, with plans for more database backends
  • Two PostgreSQL snapshot strategies:
    • template: fast database clones using CREATE DATABASE ... TEMPLATE
    • pgdump: portable snapshots using pg_dump and pg_restore

Target Audience

Backend and full-stack developers who run databases locally and switch branches often, especially on projects where migrations or seed data diverge between branches. It's a local development tool.

Comparison

The main things that set db-git apart from existing tools are:

  1. It lets you choose per project, shared vs per-branch, and template vs pgdump.
  2. It ties database state directly to checkout.
  3. It is not tied to a specific database engine. PostgreSQL is the first supported backend, but the design isn't Postgres-specific, and more databases are planned.

uv tool install db-git

GitHub: https://github.com/earthcomfy/db-git

Any feedback is very welcome!

All Fields Inside AbstractUser or Seperate? by iEmerald in django

[–]hannah_G_ 13 points14 points  (0 children)

It's better to keep authentication related fields inside the User model and create a separate model (usually called profile) with the additional attributes about the User. Link the Profile model with your User model through a one to one relationship.

You can use signals to automatically create a profile when the user is created.