{{{
from django.contrib.gis.db import models
class Node(models.Model):
id = models.PositiveBigIntegerField(primary_key=True)
point = models.PointField()
class Relation(models.Model):
id = models.PositiveBigIntegerField(primary_key=True)
nodes = models.ManyToManyField(Node)
}}}
The generated table will look like this:
{{{
Column | Type | Collation | Nullable | Default
| Storage | Stats target | Description
-------------+---------+-----------+----------+------------------------------------------------+---------+--------------+-------------
id | integer | | not null |
nextval('osm_relation_nodes_id_seq'::regclass) | plain | |
relation_id | integer | | not null |
| plain | |
node_id | integer | | not null |
| plain | |
}}}
As you can see, the PositiveBigInteger is not respected and a regular int
is set
--
Ticket URL: <https://code.djangoproject.com/ticket/32132>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
Comment:
Thanks for the report.
Note that everything works for `BigIntegerField()`.
--
Ticket URL: <https://code.djangoproject.com/ticket/32132#comment:1>
Comment (by Kfir Breger):
Thank you for the update. I'll switch to that for now.
--
Ticket URL: <https://code.djangoproject.com/ticket/32132#comment:2>
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/32132#comment:4>
* needs_tests: 1 => 0
Comment:
Add unit tests and improved the patch. Ready for another round of reviews
:)
--
Ticket URL: <https://code.djangoproject.com/ticket/32132#comment:5>
* needs_better_patch: 0 => 1
Comment:
Left some comments regarding the use of `related_fields_match_type` in
tests.
--
Ticket URL: <https://code.djangoproject.com/ticket/32132#comment:6>
* needs_better_patch: 1 => 0
Comment:
Thanks for the comment Simon! I adapted the tests, please see
https://github.com/django/django/pull/13592#issuecomment-716212270 for
more details
--
Ticket URL: <https://code.djangoproject.com/ticket/32132#comment:7>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/32132#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"cfc7cd6513a72b8c5898c264d04bdf49f897a1de" cfc7cd65]:
{{{
#!CommitTicketReference repository=""
revision="cfc7cd6513a72b8c5898c264d04bdf49f897a1de"
Fixed #32132 -- Fixed column types in m2m intermediary tables for
Positive(Big/Small)IntegerFields.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32132#comment:10>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"4ebd633350ac07091a23c0f0c3eac3aa691cab05" 4ebd633]:
{{{
#!CommitTicketReference repository=""
revision="4ebd633350ac07091a23c0f0c3eac3aa691cab05"
Refs #32132 -- Added rel_db_type() tests for auto and integer fields.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32132#comment:9>