sgflowers Posted May 22, 2003 Posted May 22, 2003 Hello, upgrading to cvs 0519 I have an issue with the 0519 snapshot as ther is a primary index on the address_book_id in the adress_book table when i try to change it so that the indexes match it i get an error here is the index currently: Keyname Type Cardinality Action Field PRIMARY PRIMARY 522 Drop Edit address_book_id customers_id idx_address_book_customers_id INDEX 522 Drop Edit customers_id error: ALTER TABLE `address_book` DROP PRIMARY KEY , ADD PRIMARY KEY ( `address_book_id` ) MySQL said: Duplicate entry '1' for key 1 can anyone help i am trying to use phpmyadmin to match the latest cvs i think it is because it switched between address_book_id being autoincrement and not but my knowledge of how indexes work is very limited
Emmtee Posted May 22, 2003 Posted May 22, 2003 you probably have multiple keys with the value 1 in your address book a primary key column is not allowed to contain duplicate values use myPHPadmin or equivalent and fix the values in the column before promoting it to a primary key :) http://www.oscommerce.com/community/contributions,1762
Emmtee Posted May 22, 2003 Posted May 22, 2003 ps: remove any default values from that column... http://www.oscommerce.com/community/contributions,1762
sgflowers Posted May 22, 2003 Author Posted May 22, 2003 # Table structure for table `address_book`# CREATE TABLE address_book ( customers_id int(11) NOT NULL default '0', address_book_id int(11) NOT NULL default '1', entry_gender char(1) NOT NULL default '', entry_company varchar(32) default NULL, entry_firstname varchar(32) NOT NULL default '', entry_lastname varchar(32) NOT NULL default '', entry_street_address varchar(64) NOT NULL default '', entry_suburb varchar(32) default NULL, entry_postcode varchar(10) NOT NULL default '', entry_city varchar(32) NOT NULL default '', entry_state varchar(32) default NULL, entry_country_id int(11) NOT NULL default '0', entry_zone_id int(11) NOT NULL default '0', PRIMARY KEY (address_book_id,customers_id), KEY idx_address_book_customers_id (customers_id) ) TYPE=MyISAM; can anyone help i am trying to make it match the cvs for 0519 but i keep getting errors
sgflowers Posted May 22, 2003 Author Posted May 22, 2003 is there any way to update this using a script i have like 400+ address that each need there own unique ids i guess what other tables are impacted?
sgflowers Posted May 22, 2003 Author Posted May 22, 2003 i don't understand the relations ship between: customers_default_address_id (table customers) and address_book_id (table address_book) if the address_book_id has the be unique (auto-increment primary index) what is the customer_default_address_id
Emmtee Posted May 22, 2003 Posted May 22, 2003 one is for the main address, the other is for additional address book entries. to upgrade your table use myPHPadmin and use ALTER instead of DROP/CREATE... that simple... hint: create a user on your own, check his UID and create a few addresses ... you'll see how the tables corelate http://www.oscommerce.com/community/contributions,1762
Harald Ponce de Leon Posted May 22, 2003 Posted May 22, 2003 There is an update script available in the extras/pr21_to_pr22 directory. An update to the table is needed due to the My Account proposal realization. , osCommerce
sgflowers Posted May 22, 2003 Author Posted May 22, 2003 ouch i had go through the customer`s table and manually renumber the default address id as all address ids are unique in the address_book table (autoincrement) thanks for the help - Kevin
Recommended Posts
Archived
This topic is now archived and is closed to further replies.