Skip to main content

Wipe migrations, reset the dev database, and sync Django models — for dev mode only.

Project description

🛠️ django-devsync

A tiny command-line tool that mimics synchronize: true from TypeORM — but for Django.

⚠️ Strictly for development use. Never use in production.


🚀 What It Does

In early-stage development, database schemas change fast and migrations get messy. django-devsync helps you:

  • 🧹 Delete all migration files
  • 💥 Reset your local DB schema
  • 🔄 Run makemigrations and migrate from scratch

All with a single command.


🛑 Don't Use In Production

This tool WILL destroy data and has minimal safeguards.

You’ve been warned 🧨


📦 Installation

pip install django-devsync

💻 Usage

devsync --delete_migrations --reset_db --run_sync

or

python -m django_devsync --delete_migrations --reset_db --run_sync

If no flags are passed, it runs all steps.

Flags

Flag Description
--delete_migrations Delete all .py and .pyc files in migrations/ directories
--reset_db Drop all tables/schemas in your local DB (SQLite/PostgreSQL/MySQL)
--run_sync Run makemigrations and migrate

📂 Example

devsync

or

python -m django_devsync

Output:

🔧 No specific flags passed — running ALL steps:
• Deleting all migrations
• Resetting the database
• Running makemigrations and migrate

✅ All done!


⚙️ Supported Databases

  • SQLite
  • MySQL
  • PostgreSQL

Uses Django's DATABASES['default']['ENGINE'] to detect backend.


🧠 How It Works

  • Prompts for your DJANGO_SETTINGS_MODULE (unless set in env)
  • Verifies DEBUG=True before proceeding
  • Uses Django internals: call_command("makemigrations"), etc.
  • Drops and recreates schemas/tables directly with SQL

📬 Contributions

Bug reports, feedback, and PRs are welcome. Stars are appreciated ⭐


📜 License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_devsync-0.1.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_devsync-0.1.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file django_devsync-0.1.1.tar.gz.

File metadata

  • Download URL: django_devsync-0.1.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for django_devsync-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0bf0f8cbe5e87c150471637cc83a456b6f8162d80730ab866018ff36dc35f7ff
MD5 cc13e95cd1d0cc5a2164f4602c313f74
BLAKE2b-256 c1f969438d566e2f4010c53a8c53980191a4e7bfee242cc41791709fff3c6f64

See more details on using hashes here.

File details

Details for the file django_devsync-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: django_devsync-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for django_devsync-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 48d7b94af25dae05383898cb19c88f92e01d17c5640a6c8b9fcc656fc6c1ad62
MD5 a17bdc683a28f97e9bd2c18fd614b9ed
BLAKE2b-256 bd872a257a2a69dfb066fadee008707cf141eba37ffddd8308de559470eced23

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page