Facing some errors when migrating a table with a ManyToManyfield (MySQL) #1729
Unanswered
dhayford92
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When i try to migrate a model with manytomanyfield this the error i get in my terminal
"Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting."
But in my mysql database all the tables are created without the manytomany field
sample:
class User(models.Model):
id = fields.UUIDField(pk=True)
fullname = fields.CharField(max_length=255)
email = fields.CharField(max_length=255, unique=True)
phone = fields.CharField(max_length=255, null=True)
password = fields.CharField(max_length=255)
class Bank(models.Model):
id = fields.UUIDField(pk=True)
name = fields.CharField(max_length=255)
address = fields.CharField(max_length=255)
users = fields.ManyToManyField('models.User', related_name='banks')
Beta Was this translation helpful? Give feedback.
All reactions