Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Integrate to Django through the makemigrations command

See original GitHub issue

Issue Description

Improve the linter to integrate directly yo the django makemigrations command.

This way only backward compatible migrations can be generated.

Suggestion of presentation:

    0003_auto_1923423432 ...
    This migration may not be backwards compatible:
    [Show linting errors here]
    You can now edit the migration manually and check again. How do you want to proceed?
    (1) Check again.
    (2) Ignore and proceed.
    (3) Delete migration and abort.

One way to integrate it, could be adding the linter to the INSTALLED_APPS in the Django settings, and then the makemigrations would get our custom behaviour.

ping FYI @flixx

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

David-Wobrockcommented, Jan 18, 2020

That might work indeed. Thanks for the suggestion @drewbrew

The obvious issue is the disparate set of arguments passed to the linter I guess that we don’t have to pass all the arguments to the linter. The goal here would be to override the “makemigrations” command to launch the linter on the new migration and suggest operations.

It would not need all the options that are needed to select or unselect migrations, which reduces a lot the scope of needed options. It would mainly need to the options to select/unselect specific things to lint for 🤔 If I have the time, I’ll try to implement a first version of this logic 😃

David-Wobrockcommented, Jul 3, 2020

@drewbrew thanks for following the issue 😃

It tooks some time to really get into it, but it should work fine now. I’ll try to release a new version of the linter with the command in the next days. Don’t hesitate to open an issue if something is not working correctly or could be improved. We can always iterate of the first approach taken 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Django App Model - Python makemigrations ...
makemigrations basically generates the SQL commands for preinstalled apps (which can be viewed in installed apps in and your newly ...
Read more >
Migrations - Django documentation
Migrations are Django's way of propagating changes you make to your models (adding a field, deleting a model, etc.) into your database schema....
Read more >
What are the Django basic app models makemigrations and ...
Makemigrations : This command prepares a makemigrations file for our new model, or creates a new migrations file for any changes if the...
Read more >
Django Migrations: A Primer - Real Python
Run ./ migrate to migrate everything or ./ migrate <app_name> to migrate an individual app; Repeat as necessary. That's it! This workflow ...
Read more >
A simple script to update a DB migration in Django 1.7+
South had the update flag for the schemamigration command, but I didn't find a similar functionality in the Django builtin makemigrations ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found