#35163: sqlite3.OperationalError: no such column: django_migrations.id
-------------------------------------+-------------------------------------
Reporter: milahu | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) | Resolution:
Severity: Normal | worksforme
Keywords: sqlite | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by milahu):
> to reproduce, build https://github.com/milahu/archivebox/tree/django4
with django 4.2.9 and run
the "no such column: id" error seems to be caused by
https://github.com/milahu/archivebox/commit/2e9a1f473ed0abaa9618d6ed6f55aa9202d7acbb
based on https://code.djangoproject.com/ticket/32577
{{{
DEFAULT_AUTO_FIELD = 'django.db.models.UUIDAutoField'
}}}
{{{
class UUIDAutoField(models.fields.AutoField, models.fields.UUIDField):
def __init__(self, *args, **kwargs):
#kwargs['db_default'] = RandomUUID()
#kwargs['db_default'] = uuid.uuid4()
super().__init__(*args, **kwargs)
def deconstruct(self):
name, path, args, kwargs = super().deconstruct()
#del kwargs['db_default']
return name, path, args, kwargs
def get_internal_type(self):
return 'UUIDAutoField'
def rel_db_type(self, connection):
return models.fields.UUIDField().db_type(connection=connection)
models.UUIDAutoField = UUIDAutoField
}}}
because later, i get the same "no such column: id" error, when django is
trying to migrate this SQL table
{{{
class Snapshot(models.Model):
# FIXME sqlite3.OperationalError: table new__core_snapshot has no
column named id
id = models.UUIDAutoField(primary_key=True, default=uuid.uuid4,
editable=False)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35163#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018d71227dee-93fd466c-8c15-49a0-b4b9-c9ea36ab478f-000000%40eu-central-1.amazonses.com.