How do i remove a field from a model inheriting from another model if migrations already set the `bases` attribute in CreateModel

this is a fragment of the initial migration:

migrations.CreateModel(
            name='Customer',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('email', models.EmailField(max_length=255, unique=True, verbose_name='email address')),
                ('first_name', models.CharField(max_length=50, verbose_name='Imię')),
                ('last_name', models.CharField(max_length=50, verbose_name='Nazwisko')),
                ('nip', shop.models.customer.NipField(blank=True, max_length=10, verbose_name='NIP')),
                ('company_name', models.CharField(blank=True, max_length=100, verbose_name='Nazwa firmy')),
                ('city', models.CharField(blank=True, max_length=50, verbose_name='Miasto')),
                ('street', models.CharField(blank=True, max_length=50, verbose_name='Ulica')),
                ('house_number', models.CharField(blank=True, max_length=10, verbose_name='Numer domu')),
                ('postal_code', models.CharField(blank=True, max_length=6, verbose_name='Kod pocztowy')),
                ('apartment_number', models.CharField(blank=True, max_length=10, verbose_name='Numer mieszkania')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CustomerCopyForOrder',
            fields=[
                ('customer_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='shop.customer')),
                ('related_customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='copy', to='shop.customer')),
            ],
            options={
                'abstract': False,
            },
            bases=('shop.customer',),
        ),

fragment of CustomerCopyForOrder class

class CustomerCopyForOrder(Customer):
    related_customer = models.ForeignKey(Customer, on_delete=models.SET_NULL, related_name='copy', null=True, blank=True)
    account = None
    email = models.EmailField(verbose_name="email", max_length=255, unique=False, blank=True)

I’ve tried to make a custom migration

# Generated by Django 3.2.16 on 2023-07-04 10:34

from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ('shop', '0007_auto_20230704_1219'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='CustomerCopyForOrder',
            name='account'
        ),
    ]

Error when running migrate

Traceback (most recent call last):
  File "C:\Users\micha\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\231.9011.38\plugins\python\helpers\pycharm\django_manage.py", line 59, in <module>
    run_command()
  File "C:\Users\micha\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\231.9011.38\plugins\python\helpers\pycharm\django_manage.py", line 46, in run_command
    run_module(manage_file, None, '__main__', True)
  File "C:\Python310\lib\runpy.py", line 224, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "C:\Python310\lib\runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users/micha/Desktop/work/marcom/marcom-strona\manage.py", line 22, in <module>
    main()
  File "C:\Users/micha/Desktop/work/marcom/marcom-strona\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Python310\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "C:\Python310\lib\site-packages\django\core\management\__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python310\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Python310\lib\site-packages\django\core\management\base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "C:\Python310\lib\site-packages\django\core\management\base.py", line 89, in wrapped
    res = handle_func(*args, **kwargs)
  File "C:\Python310\lib\site-packages\django\core\management\commands\migrate.py", line 244, in handle
    post_migrate_state = executor.migrate(
  File "C:\Python310\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "C:\Python310\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "C:\Python310\lib\site-packages\django\db\migrations\executor.py", line 227, in apply_migration
    state = migration.apply(state, schema_editor)
  File "C:\Python310\lib\site-packages\django\db\migrations\migration.py", line 116, in apply
    operation.state_forwards(self.app_label, project_state)
  File "C:\Python310\lib\site-packages\django\db\migrations\operations\fields.py", line 162, in state_forwards
    old_field = model_state.fields.pop(self.name)
KeyError: 'account'

Customer is not an abstract class. This means that you are using Multi-table inheritance with your CustomerCopyForOrder model.

I’m going to make the assumption that this isn’t what you really want to do here. You’re already creating a ForeignKey to Customer - I don’t believe you want to inherit from that class as well.

I think you should take a step back and re-think your data models in the abstract before defining your Django models to ensure the right tables with the right data are being created.

yeah i just though that there’s maybe a way to get around that without having to refactor, thanks anyway, this refactor will probably be for the better

I do want to make sure you’re clear on this - with what you’ve defined, there was no account field in CustomerCopyForOrder to be removed. Your custom migration failed because there wasn’t anything to do.

yeah i understand, i just didn’t know about multi-table inheritance, i thought that it will inherit just like from a model marked abstract
Thanks for the help!