Jump to content

Error Presta on Server 2012 R2: SQL error on query All parts of a PRIMARY KEY must be NOT NULL


Recommended Posts

Hi,

 

I'm new to prestashop. I want to setup Presta on a Server 2012 R2 box. Here are the steps I took:

- Installed IIS, PHP (used the Web Platform downloader) and MySQL.

- Created a schema, a user and provided the user full permissions on the schema.

- Created a website and copied the downloaded Presta files to the correct location.

- Browsed to the website and followed the steps. At 12%, when the database is created the attached error occurs.

 

SQL error on query All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead

The database is filled with tables though, so it's not a permissions issue I think.

 

The versions I use (all the latest that can be found).

- MySQL: 5.7

- PHP 5.6.0 (5.3.28 is also installed).

- Presta: 1.6.12.

 

I don't have any experience with PHP / MySQL so I'm really stuck.

 

Can anyone provide some guidance how I can get the site setup ?

 

Thanks.

post-1129260-0-13115400-1446716968_thumb.png

Edited by MarcDieters (see edit history)
Link to comment
Share on other sites

I have found the issue. To fix it, replace the following text in the db_structure.sql in \install\data

 

CREATE TABLE `PREFIX_cart_product` (
  `id_cart` int(10) unsigned NOT NULL,
  `id_product` int(10) unsigned NOT NULL,
  `id_address_delivery` int(10) UNSIGNED DEFAULT '0',
  `id_shop` int(10) unsigned NOT NULL DEFAULT '1',
  `id_product_attribute` int(10) unsigned DEFAULT NULL,
  `quantity` int(10) unsigned NOT NULL DEFAULT '0',
  `date_add` datetime NOT NULL,
  UNIQUE(`id_cart`,`id_product`,`id_product_attribute`,`id_address_delivery`),
  KEY `id_product_attribute` (`id_product_attribute`),
  KEY `id_cart_order` (`id_cart`, `date_add`, `id_product`, `id_product_attribute`)
);​

 

After this change, I was able to complete the store creation.

  • Like 5
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 1 month later...

I have found the issue. To fix it, replace the following text in the db_structure.sql in \install\data

 

CREATE TABLE `PREFIX_cart_product` (

  `id_cart` int(10) unsigned NOT NULL,

  `id_product` int(10) unsigned NOT NULL,

  `id_address_delivery` int(10) UNSIGNED DEFAULT '0',

  `id_shop` int(10) unsigned NOT NULL DEFAULT '1',

  `id_product_attribute` int(10) unsigned DEFAULT NULL,

  `quantity` int(10) unsigned NOT NULL DEFAULT '0',

  `date_add` datetime NOT NULL,

  UNIQUE(`id_cart`,`id_product`,`id_product_attribute`,`id_address_delivery`),

  KEY `id_product_attribute` (`id_product_attribute`),

  KEY `id_cart_order` (`id_cart`, `date_add`, `id_product`, `id_product_attribute`)

);​

 

After this change, I was able to complete the store creation.

 

Awesome! Thanks for the help! :)

Link to comment
Share on other sites

  • 4 weeks later...
  • 5 months later...
  • 6 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...