I am working in djongo and i created a new model and apply the migrations. My newly created model is:
class NetworkIgnoreUsers(models.Model):
_id = M.ObjectIdField()
userId = models.CharField(max_length=50,blank=True,null=True)
ignoreUserId = models.CharField(max_length=50,blank=True,null=True)
mutualConnect = models.BigIntegerField(default=0)
createTime = models.DateTimeField(blank=True,null=True)
class Meta:
indexes = [
models.Index(fields=['userId'],name='idx_network_user_id'),
models.Index(fields=['ignoreUserId'],name='idx_network_ignore_user_id'),
models.Index(fields=['createTime'],name='idx_post_create_time')
]
After doing
python manage.py makemigrations
The output of makemigrations is
- Create model NetworkIgnoreUsers
- Add field hidden to post
- Create index idx_post_hidden on field(s) hidden of model post
- Create index idx_network_user_id on field(s) userId of model networkignoreusers
- Create index idx_network_ignore_user_id on field(s) ignoreUserId of model networkignoreusers
- Create index idx_post_create_time on field(s) createTime of model networkignoreusers
After applying makemigrations i applied
python manage.py migrate
It is giving me the error djongo.sql2mongo.SQLDecodeError: FAILED SQL: CREATE TABLE shareactivity Although that table has been migrated succesfully in my last migration.My latest migration file no. is 23 and inside it, It has dependenices on file n 22 and in file 22 i have that shareactivity table migration. The shareactivity model is:
class ShareActivity(models.Model):
_id = M.ObjectIdField()
shareId = models.CharField(max_length=50, blank=True, null=True)
userId = models.CharField(max_length=50, blank=True, null=True)
activityId = models.CharField(max_length=50,blank=True, null=True)
activityType = models.CharField(max_length=50, blank=True, null=True)
parentId = models.CharField(max_length=50, blank=True, null=True)
updateTime=models.DateTimeField(blank=True,null=True)
class Meta:
indexes = [
models.Index(fields=['shareId'], name='idx_shareid'),
models.Index(fields=['userId'], name='idx_userid'),
models.Index(fields=['activityId'], name='idx_activityid'),
models.Index(fields=['activityType'], name='idx_activitytype'),
models.Index(fields=['parentId'], name='idx_parentid'),
models.Index(fields=['updateTime'], name='idx_updatetime'),
]