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.

PyPI

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.


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.2.tar.gz (7.9 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.2-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_devsync-0.1.2.tar.gz
  • Upload date:
  • Size: 7.9 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.2.tar.gz
Algorithm Hash digest
SHA256 dd8ac2779c5485f2354bb142951c08a0188affdf3dc54353910671aba890beb1
MD5 8ebece6c2d1eb184f0ddeee1128d1ed3
BLAKE2b-256 3e928bab69178d79f6be6de0f54acc46ca44be25504bd6f6a46a83bf00693cf7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_devsync-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b9d041122e1cb2eb47a5f203bb083a798df3e2f31f14fe44d1a19f10189d191f
MD5 2c90cc238c42b71534033f792491bb1a
BLAKE2b-256 71e0e2f1bfd871222beab61f4217d7e7b145dfd0c2bcadeaab1a06e490f89aab

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