[Django] #33831: How can I create model without primary_key

4 views
Skip to first unread message

Django

unread,
Jul 7, 2022, 7:23:48 AM7/7/22
to django-...@googlegroups.com
#33831: How can I create model without primary_key
-------------------------------------+-------------------------------------
Reporter: 007 | Owner: nobody
Type: | Status: new
Uncategorized |
Component: Database | Version: 4.0
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I have two models:
{{{
class Info(models.Model):
name = models.CharField(verbose_name='name', max_length=128)

class Meta:
verbose_name = verbose_name_plural = "name"


class Version(models.Model):
id = None
info = models.ForeignKey(Info, on_delete=models.DO_NOTHING,
db_constraint=False)
version = models.CharField(verbose_name='version number',
max_length=128)

class Meta:
unique_together = ('version', 'info')
verbose_name = verbose_name_plural = "name"
}}}
I want to add mysql PARTITION to version.
PARTITION KEY must be included by all unique indexes.
so I want to remove id like

{{{
CREATE TABLE `version` (
`version` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
NOT NULL,
`package_id` bigint NOT NULL,
UNIQUE KEY `version_version_package_id_fc0eb1b8_uniq`
(`version`,`package_id`),
KEY `version_package_id_2d2bab67` (`package_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
/*!50100 PARTITION BY KEY (package_id)
PARTITIONS 32 */
}}}
How can I modify models to meet my needs

--
Ticket URL: <https://code.djangoproject.com/ticket/33831>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 7, 2022, 7:45:47 AM7/7/22
to django-...@googlegroups.com
#33831: How can I create model without primary_key
-------------------------------------+-------------------------------------
Reporter: 007 | Owner: nobody
Type: Uncategorized | Status: closed
Component: Database layer | Version: 4.0
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => invalid


Comment:

Please don't use Trac as a support channel. Closing per
TicketClosingReasons/UseSupportChannels.

--
Ticket URL: <https://code.djangoproject.com/ticket/33831#comment:1>

Reply all
Reply to author
Forward
0 new messages