Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2023-12-03 15:01:50

bg1
New Member
Registered: 2023-12-01
Posts: 8
Mastodon

DB Table txp_section has no primary key

Rather a hint than anything else:

While modifying some section data directly on the table level (setting dev_skin’s), I noticed that the table itself has no primary key.
I believe the intent with the first column, txp_section.name is to have it unique, so I made it primary key (and since primary key, changed it from varchar to char and due to size limitations down to 100 instead of former 255):

ALTER TABLE `<YourDbNameHere>`.`txp_section`
CHANGE COLUMN `name` `name` CHAR NOT NULL DEFAULT ‘’ ,
ADD PRIMARY KEY (`name`);

Have not checked the other tables, but potentially more tables are flying about without primary keys. It might also be that indices can be optimized.

Offline

#2 2023-12-03 15:23:10

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: DB Table txp_section has no primary key

Weird. They should all have primary keys. Surprised it’s not set.

Edit: wait. The missing primary keys were only added as part of the upcoming 4.9.0. Affected tables:

txp_css
txp_form
txp_page
txp_plugin
txp_prefs
txp_section

Last edited by Bloke (2023-12-03 15:26:04)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2023-12-04 08:29:27

bg1
New Member
Registered: 2023-12-01
Posts: 8
Mastodon

Re: DB Table txp_section has no primary key

Got you.

Offline

Board footer

Powered by FluxBB