question-mark
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.

Allow ignoring migrations from a specific application

See original GitHub issue

In our application, we’re using the waffle feature-flag library. The first migration they define (0001_initial) triggers warnings:

(waffle, 0001_initial)... WARNING
	CREATE INDEX locks table
	CREATE INDEX locks table
	CREATE INDEX locks table
	CREATE INDEX locks table
	CREATE INDEX locks table
	CREATE INDEX locks table
	CREATE INDEX locks table
	CREATE INDEX locks table
	CREATE INDEX locks table
	CREATE INDEX locks table
(waffle, 0002_auto_20161201_0958)... OK
(waffle, 0003_update_strings_for_i18n)... OK

As far as I can tell, the only way I can exclude this migration is by name (0001_initial). However, other apps will use this 0001_initial naming convention by default, as well.

It would be nice if we could somehow exclude this migration by name and app. That way, 0001_initial in the specified app would not be included, but 0001_initial in all other apps would be included.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
David-Wobrockcommented, Mar 16, 2022

Why not, good suggestion 👍

Let’s reflect on that a little bit

1reaction
blimmercommented, Mar 16, 2022

👍 thanks for the response. If you’d be willing to make a breaking change, I wonder if you could change the way migrations are specified as parameters to <appname>.<id>.

What might be nice about passing these as strings is you could allow passing regex-like strings as well. Then you wouldn’t have to have the somewhat duplicative --ignore-name --ignore-name-contains flags. Using a regex would also invert the responsibility to the user to avoid overlap in how they’re including/excluding migrations.

For example, this would cover my use case:

--exclude 'waffle.0001_initial`

But you could also do other clever things like:

# old
--ignore-name '0001_initial'

# new
--exclude '*.0001_initial`
# old
--exclude-apps 'waffle'

# new
--exclude 'waffle.*'

This syntax might be less user-friendly than the current options but would allow for a lot of flexibility. Just a thought 💡 🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exclude an app from Django migrations - Stack Overflow
This answer is the right answer to specifically the question I asked. In my case however, I am using dynamic models.
Read more >
How to fix/ignore pending migration in 3rd-party app?
Is there a workaround (even an ugly hack) I could use to tell makemigrations to ignore a specific app? I've tried using MIGRATION_MODULES ......
Read more >
Enable Prisma to ignore specified / only look at ... - GitHub
Problem I am developing an application that uses Prisma to facilitate DB operations with DB/tables and I am using Prisma migrations to ...
Read more >
Customize validation rules with ignoreMigrationPatterns
ignoreMigrationPatterns let's you specify classes of migration type and migration status to ignore during validate, but what if you need to ...
Read more >
Tutorial: Use EF Migrations in an ASP.NET MVC app and ...
In this article · Prerequisites · Enable Code First migrations · Deploy to Azure · Advanced migrations scenarios · Update specific migration ·...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found