Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I noticed that a few of the tables provided by the module doesn't include a primary key.
The tables without a primary key are:
- nodequeue_nodes
- nodequeue_roles
- nodequeue_types
Comment | File | Size | Author |
---|---|---|---|
#9 | primary_key_doesn_t-2701449-5.patch | 4.39 KB | joaocsilva |
#8 | primary_key_doesn_t-2701449-4.patch | 4.3 KB | joaocsilva |
#2 | primary_key_doesn_t-2701449-2.patch | 3.12 KB | jrglasgow |
Comments
Comment #2
jrglasgow CreditAttribution: jrglasgow commentedhere is a patch that will add an extra auto incrementing id column to each of the above tables and set it as the primary key.
Comment #4
fizk CreditAttribution: fizk commentedWhat issues were you trying to fix by creating a primary key for those tables?
Comment #5
trevorw CreditAttribution: trevorw commentedRunning any of the Galera cluster products from MariaDB, Percona, etc ... all tables require a primary key.
Comment #6
trevorw CreditAttribution: trevorw commentedpatched worked fine for me, easy add. Thx
Comment #7
joaocsilva CreditAttribution: joaocsilva at European Commission and European Union Institutions, Agencies and Bodies commentedThe patch does not apply due to the hook_update number, I'm increasing it by one.
Comment #8
joaocsilva CreditAttribution: joaocsilva at European Commission and European Union Institutions, Agencies and Bodies commentedThe previous patch did not work, I am uploading a new one.
Comment #9
joaocsilva CreditAttribution: joaocsilva at European Commission and European Union Institutions, Agencies and Bodies commentedAccording to this page https://www.drupal.org/node/2615496 , adding a new serial field on an existing table can fail on some databases, as a workaround we can create first a int field and change it to serial.
I am uploading a new patch.
Comment #10
joaocsilva CreditAttribution: joaocsilva at European Commission and European Union Institutions, Agencies and Bodies commentedComment #11
jenlamptonThanks for this fix @joaocsilva, can you tell me what I need to do to test this patch? How can I reproduce the problem this fixes? Thanks!
Comment #12
ccarnnia CreditAttribution: ccarnnia as a volunteer and commentedHello @jenlampton.
one of nodequue table is nodequeue_NODES.
before the patch:
mysql> describe nodequeue_nodes;
+-----------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+-------+
| qid | int(10) unsigned | NO | MUL | NULL | |
| sqid | int(10) unsigned | NO | MUL | NULL | |
| nid | int(10) unsigned | YES | MUL | NULL | |
| position | int(10) unsigned | YES | | NULL | |
| timestamp | int(10) unsigned | NO | | 0 | |
+-----------+------------------+------+-----+---------+-------+
after the patch:
mysql> describe nodequeue_nodes;
+-----------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+----------------+
| qid | int(10) unsigned | NO | MUL | NULL | |
| sqid | int(10) unsigned | NO | MUL | NULL | |
| nid | int(10) unsigned | YES | MUL | NULL | |
| position | int(10) unsigned | YES | | NULL | |
| timestamp | int(10) unsigned | NO | | 0 | |
| id | int(11) | NO | PRI | NULL | auto_increment |
+-----------+------------------+------+-----+---------+----------------+
as you can see a 6th column named id that auto increments has been added.
Comment #13
jenlamptonThanks @ccarnnia, I was able to see the result of the patch is that a primary key was added, but I was wondering how to reproduce a problem caused by not having a primary key. Do you have any examples of how I might encounter one of those problems?