e-commerce-db icon indicating copy to clipboard operation
e-commerce-db copied to clipboard

Giving error when importing the file

Open iampankajkumar opened this issue 6 years ago • 3 comments

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'time zone not null, updated_at timestamp with time zone not null,

iampankajkumar avatar Nov 11 '19 06:11 iampankajkumar

@iampankajkumar which version of mysql are you using? Is this happening running the initial script? or adding values?

If you are inserting data, you can put a timestamp in the updated field, as is required to be 'not null'.

ramortegui avatar Nov 12 '19 12:11 ramortegui

pankaj@DESKTOP-ELG78SB:~$ mysql --version mysql Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using EditLine wrapper

Please help me to write the query to create table.

iampankajkumar avatar Nov 12 '19 17:11 iampankajkumar

@iampankajkumar the error is on the updated_at and inserted_at fields. you could replace on a/export/ecommerce-db-mysql-innodb.sql file :

-   inserted_at timestamp with time zone not null,
-   updated_at  timestamp with time zone not null,
+   inserted_at timestamp default 0,
+   updated_at  timestamp default 0,

all the ocurrences.

If you are using a framework to use the template, you will find some shortcuts to fill out those fields for you. if not, you could initialize it by yourself on the database table definition[1].

[1] https://dev.mysql.com/doc/refman/5.5/en/timestamp-initialization.html

ramortegui avatar Nov 12 '19 20:11 ramortegui