No such Table Problem

I have an application it was working pretty good till this happen.

1st- I use sqlite DB it have 46 tabels.

2nd- I am trying to creat a new table (botomeqpts) as:

1- in created this:

class Botomeqpts(models.Model):
    code_BtE     = models.CharField(max_length=16,unique=True)
    designation  = models.CharField(max_length=150)
    fournisseu   = models.CharField(max_length=80)
    Emplacement  = models.CharField(max_length=20)
    Qte_stock    = models.IntegerField(blank=True, null=True)
    Nbr_comnd    = models.CharField(max_length=10,blank=True ,null=True)
    Nbr_comndQ   = models.IntegerField(blank=True ,null=True)
    Observation  = models.TextField(blank=True ,null=True)
    mvmnt_date   = models.DateField(blank=True ,null=True)
    author_Up    = models.CharField(max_length=16,blank=True ,null=True) #CASCADE()
    date_Up      = models.DateField(blank=True ,null=True)
    post_date   = models.DateTimeField(
    author      = models.ForeignKey(User,on_delete=models.CASCADE) #CASCADE()
    def __str__(self):
        return self.code_BtE
    class Meta:
        ordering = ('-post_date',)

2- I registered the model name in as:

3- I run the following code of migration:

migrate --fake

And after from the admin panel I checked the table (Botomeqpts)
and It appear in the list but when I try to add the data it give me this error (image1)?

and when I explore the database from Sqlite browser I don’t found the table (image3) ???

But from the admin I found the Table name as (image2)

and trying to add some data it gives me the page (image4), but when register it give me tha error as presented in the first picture (image1)!??

So please do I forget and step or I made an error (I’d 7 months didn’t used Django :slight_smile: )

All My Best

Is there a reason why you used the --fake parameter on your migrate command? Unless you had already created that table in the database, that was exactly the wrong thing to do here.

In fact this was after many tries of simple migrate
and makemigrations --merge and many other solution I found in the web but I am not able to create this table?

The issue is that since you’ve used “fake”, Django has marked that that migration has been applied, and won’t apply it again. You need to run migrate to “undo” that migration, then run it again without the fake to have it actually apply.

You can use showmigrations to see what the migration is before this latest one.

If you’re unable to get this working, post the complete output from a showmigrations command, and we might be able to help you along. Also, look at your migration files and identify which migration is responsible for creating that table. Identify which migration that one depends on.

Many thanks to your support but I did already many time with many tables migrate doen’t work
and this is the showmigration report:

IN UPDATE FORM 113 <class 'Home.forms.EventRptForm'>
 [X] 0001_initial
 [X] 0002_auto_20200714_1724
 [X] 0003_auto_20200714_1833
 [X] 0004_testprodm_wlid_tstdt
 [X] 0005_auto_20200714_1904
 [X] 0006_auto_20200718_0815
 [X] 0007_auto_20200719_0928
 [X] 0008_auto_20200719_0929
 [X] 0009_auto_20200719_0931
 [X] 0010_auto_20200719_1121
 [X] 0011_auto_20200719_1433
 [X] 0012_auto_20200719_1507
 [X] 0013_auto_20200719_1626
 [X] 0014_auto_20200722_2203
 [X] 0015_auto_20200913_1117
 [X] 0016_auto_20200913_1645
 [X] 0017_auto_20200913_1649
 [X] 0018_auto_20200913_1803
 [X] 0019_auto_20200913_1853
 [X] 0020_auto_20200913_1857
 [X] 0021_auto_20200913_1929
 [X] 0022_auto_20200913_1933
 [X] 0023_auto_20200914_0857
 [X] 0024_auto_20200914_0905
 [X] 0025_auto_20200914_0938
 [X] 0026_auto_20200914_1617
 [X] 0027_auto_20200914_1646
 [X] 0028_auto_20200915_0733
 [X] 0029_auto_20200915_1030
 [X] 0030_auto_20200917_1548
 [X] 0031_auto_20200920_1002
 [X] 0032_auto_20200920_1007
 [X] 0033_auto_20200920_1458
 [X] 0034_auto_20200921_0833
 [X] 0035_auto_20200921_1435
 [X] 0036_auto_20200921_1457
 [X] 0037_auto_20200922_1708
 [X] 0038_auto_20200925_1524
 [X] 0039_auto_20201112_1537
 [X] 0059_auto_20200713_1055
 [X] 0060_auto_20200714_1510
 [X] 0061_auto_20210528_1547
 [X] 0062_auto_20210528_1652
 [X] 0063_auto_20210528_1704
 [X] 0064_auto_20210528_1850
 [X] 0001_initial
 [X] 0002_logentry_remove_auto_add
 [X] 0001_initial
 [X] 0002_alter_permission_name_max_length
 [X] 0003_alter_user_email_max_length
 [X] 0004_alter_user_username_opts
 [X] 0005_alter_user_last_login_null
 [X] 0006_require_contenttypes_0002
 [X] 0007_alter_validators_add_error_messages
 [X] 0008_alter_user_username_max_length
 [X] 0009_alter_user_last_name_max_length
 [X] 0001_initial
 [X] 0002_remove_content_type_name
 [X] 0001_initial
 [X] 0001_initial
 [X] 0002_profile_job_title
 [X] 0003_profile_service
Following files were affected 
Process finished with exit code 0

Do you have the answers to my other questions?

Yes I have those last 4 files
My migration files

You’ve deleted those migration files from your project?
Ok, delete your database and rebuild it from scratch. Trying to get your migrations resynced with your database at this point is probably more trouble than it’s worth. (It can be done, but it may turn out to be a lot of work.)