#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.

-- 
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/01070181d866ce89-32ad1dcf-62c6-4b39-9741-102e51db035d-000000%40eu-central-1.amazonses.com.

Reply via email to