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.

Create a check for initial migrations

See original GitHub issue

Today I found a code like this:

class Migration(migrations.Migration):

    # initial = True
    dependencies = []

And this was an initial migration for an app.

This suprised me:

  1. It works correctly
  2. It does not produce any warnings
  3. It is cryptic

What am I concerned about? I have an impression that all migrations with dependencies = [] must be initial, because otherwise they should be dependent on a previous migration. Am I correct?

So, I guess we can check this pretty easily in case initial really works this way.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
skarzicommented, Jan 17, 2022

hello @denisSurkov 👋

I think it’s still relevant, however, we haven’t got time to work on this issue, so any help is really appreciated. To be honest, I haven’t checked how to implement this feature, but the general process could look like this:

  1. Let’s add a new file with checks to this directory a) Maybe MigrationLoader.graph.root_nodes() can be used to implement initial = True check
  2. Let’s add a new app config class MigrationClasses to this file so migration-related checks can be included separately

Of course, don’t forget about unit tests of all newly introduced code. Let’s ping me if you have any questions etc 😉

0reactions
denisSurkovcommented, Jan 14, 2022

Hi

Is there any activity here? Is it still relevant?

And if so, what do you expect from this feature?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code First Migrations - EF6 - Microsoft Learn
Customizing Migrations. So far we've generated and run a migration without making any changes. Now let's look at editing the code that gets ......
Read more >
Code-Based Migration in Entity Framework 6
To use code-based migrations, first execute the enable-migrations command in the Package Manager Console. Open the Package Manager Console from Tools → Library ......
Read more >
Migrations and Seed Data With Entity Framework Core
The migration process has two steps: Creating migration and Applying ... The first thing it does is inspect our class, associated entity ...
Read more >
Migrations - Django documentation
For an initial migration that creates one or more tables ( CreateModel operation), Django checks that all of those tables already exist in...
Read more >
Entity Framework Core Migrations
The target migration is the point to which you want to restore the database. For example, if your first migration is named "Create",...
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