Forum Moderators: open

Message Too Old, No Replies

Mysql Alter Table

Change status of Drupal Module off

         

russgri

1:13 pm on Mar 27, 2006 (gmt 0)

10+ Year Member



Here is the code:
CREATE TABLE system (
filename varchar(255) NOT NULL default '',
name varchar(255) NOT NULL default '',
`type` varchar(255) NOT NULL default '',
description varchar(255) NOT NULL default '',
`status` int(2) NOT NULL default '0',
throttle tinyint(1) NOT NULL default '0',
bootstrap int(2) NOT NULL default '0',
PRIMARY KEY (filename)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO system VALUES ('modules/gallery/gallery.module', 'gallery', 'module', 'Integration with Gallery2 (http://gallery.menalto.com/)', 1, 1, 0);

Where 1, 1, 0);
Where 0, 0, 0); ...to turn status of module to off and throttle to off

The error comes with the 'filename' ....the key...is duplicated.
ie:

('modules/gallery/gallery.module', 

How do I structure the query to turn the status to off without duplicating the filename, which is the key?

physics

4:48 am on Mar 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure I understand what's going on here, but do you want to do an UPDATE instead of an INSERT? Or you can do a REPLACE INTO to overwrite the old value...

sacx13

12:32 pm on Mar 31, 2006 (gmt 0)

10+ Year Member



You have 2 choices:

1. Use update to update the data from table
2. Change the structure of the table changeing the primary key

Regards