All Projects → 3YOURMIND → Django Migration Linter

3YOURMIND / Django Migration Linter

Licence: apache-2.0
🚀 Detect backward incompatible migrations for your django project

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Django Migration Linter

Postgres Migrations
🐦 A Stack Overflow-inspired PostgreSQL migration library with strict ordering and immutable migrations
Stars: ✭ 161 (-30.3%)
Mutual labels:  migrations, database, postgresql
Linq2db
Linq to database provider.
Stars: ✭ 2,211 (+857.14%)
Mutual labels:  database, mysql, postgresql
Usaspending Api
Server application to serve U.S. federal spending data via a RESTful API
Stars: ✭ 166 (-28.14%)
Mutual labels:  database, postgresql, django
Dapper.fsharp
Lightweight F# extension for StackOverflow Dapper with support for MSSQL, MySQL and PostgreSQL
Stars: ✭ 145 (-37.23%)
Mutual labels:  database, mysql, postgresql
Condenser
Condenser is a database subsetting tool
Stars: ✭ 189 (-18.18%)
Mutual labels:  database, mysql, postgresql
Querybuilder
SQL query builder, written in c#, helps you build complex queries easily, supports SqlServer, MySql, PostgreSql, Oracle, Sqlite and Firebird
Stars: ✭ 2,111 (+813.85%)
Mutual labels:  database, mysql, postgresql
Db
Data access layer for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.
Stars: ✭ 2,832 (+1125.97%)
Mutual labels:  database, mysql, postgresql
Kangaroo
SQL client and admin tool for popular databases
Stars: ✭ 127 (-45.02%)
Mutual labels:  database, mysql, postgresql
Django Sharding
A sharding library for Django
Stars: ✭ 184 (-20.35%)
Mutual labels:  database, postgresql, django
Nut
Advanced, Powerful and easy to use ORM for Qt
Stars: ✭ 181 (-21.65%)
Mutual labels:  database, mysql, postgresql
Scany
Library for scanning data from a database into Go structs and more
Stars: ✭ 228 (-1.3%)
Mutual labels:  database, mysql, postgresql
Shardingsphere
Build criterion and ecosystem above multi-model databases
Stars: ✭ 14,989 (+6388.74%)
Mutual labels:  database, mysql, postgresql
Sql Fundamentals
👨‍🏫 Mike's SQL Fundamentals and Professional SQL Courses
Stars: ✭ 140 (-39.39%)
Mutual labels:  database, mysql, postgresql
Database To Plantuml
Compile PostgreSQL and MySQL table information into a PlantUML description.
Stars: ✭ 157 (-32.03%)
Mutual labels:  database, mysql, postgresql
Goose
A database migration tool. Supports SQL migrations and Go functions.
Stars: ✭ 2,112 (+814.29%)
Mutual labels:  database, mysql, migrations
Sqlcheck
Automatically identify anti-patterns in SQL queries
Stars: ✭ 2,062 (+792.64%)
Mutual labels:  database, mysql, postgresql
Directus
Open-Source Data Platform 🐰 — Directus wraps any SQL database with a real-time GraphQL+REST API and an intuitive app for non-technical users.
Stars: ✭ 13,190 (+5609.96%)
Mutual labels:  database, mysql, postgresql
Dbmate
🚀 A lightweight, framework-agnostic database migration tool.
Stars: ✭ 2,228 (+864.5%)
Mutual labels:  migrations, mysql, postgresql
Scalardb
Universal transaction manager
Stars: ✭ 178 (-22.94%)
Mutual labels:  database, mysql, postgresql
Migrate
Database migrations. CLI and Golang library.
Stars: ✭ 2,315 (+902.16%)
Mutual labels:  migrations, database, mysql

Django migration linter

Detect backward incompatible migrations for your Django project. It will save you time by making sure migrations will not break with a older codebase.

Build Status PyPI PR_Welcome 3YD_Hiring GitHub_Stars

Quick installation

pip install django-migration-linter

And add the migration linter your INSTALLED_APPS:

    INSTALLED_APPS = [
        ...,
        "django_migration_linter",
        ...,
    ]

Usage example

$ python manage.py lintmigrations

(app_add_not_null_column, 0001_create_table)... OK
(app_add_not_null_column, 0002_add_new_not_null_field)... ERR
        NOT NULL constraint on columns
(app_drop_table, 0001_initial)... OK
(app_drop_table, 0002_delete_a)... ERR
        DROPPING table
(app_ignore_migration, 0001_initial)... OK
(app_ignore_migration, 0002_ignore_migration)... IGNORE
(app_rename_table, 0001_initial)... OK
(app_rename_table, 0002_auto_20190414_1500)... ERR
        RENAMING tables

*** Summary ***
Valid migrations: 4/8
Erroneous migrations: 3/8
Migrations with warnings: 0/8
Ignored migrations: 1/8

The linter analysed all migrations from the Django project. It found 3 migrations that are doing backward incompatible operations and 1 that is explicitly ignored. The list of incompatibilities that the linter analyses can be found at docs/incompatibilities.md.

More advanced usages of the linter and options can be found at docs/usage.md.

Integration

One can either integrate the linter in the CI and the lintmigrations command, or detect incompatibilities during generation with

$ python manage.py makemigrations --lint

Migrations for 'app_correct':
  tests/test_project/app_correct/migrations/0003_a_column.py
    - Add field column to a
Linting for 'app_correct':
(app_correct, 0003_a_column)... ERR
        NOT NULL constraint on columns

The migration linter detected that this migration is not be backward compatible.
- If you keep the migration, you will want to fix the issue or ignore the migration.
- By default, the newly created migration file will be deleted.
Do you want to keep the migration? [y/N]
[...]
Deleted tests/test_project/app_correct/migrations/0003_a_column.py

The linter found that the newly created migration is not backward compatible and deletes the files. This behaviour can be the default of the makemigrations command through the MIGRATION_LINTER_OVERRIDE_MAKEMIGRATIONS Django settings. Find out more about the makemigrations command at docs/makemigrations.md.

More information

Please find more documentation generally in the docs/ folder.

Some implementation details can found in the ./docs/internals/ folder.

Blog post

They talk about the linter

Related

  • django-test-migrations - Test django schema and data migrations, including migrations' order and best practices.

License

django-migration-linter is released under the Apache 2.0 License.

Maintained by David Wobrock
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].