When I run the sql code in the installation method, it shows me a syntax error.
my sql code :
CREATE TABLE PREFIX_wallet (
`id` INT NOT NULL,
`id_customer` INT NOT NULL,
`cash` INT DEFAULT 0,
`data_add` DATETIME DEFAULT CURRENT_TIMESTAMP,
`data_upd` DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_customer`) REFERENCES `PREFIX_customer`(`id_customer`)
);
CREATE TABLE PREFIX_wallet_history (
`id` INT NOT NULL,
`id_customer` INT NOT NULL,
`id_wallet` INT NOT NULL,
`last_amount` INT NOT NULL,
`Summary` TEXT(255) NOT NULL,
`data_add` DATETIME DEFAULT CURRENT_TIMESTAMP,
`data_upd` DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_customer`) REFERENCES `PREFIX_customer`(`id_customer`),
FOREIGN KEY (`id_wallet`) REFERENCES `PREFIX_wallet`(`id`)
);
The prefix part is replaced with a DB_PREFIX code.
error :
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 'CREATE TABLE ps_wallet_history (
id INT NOT NULL,
id_customer INT NOT NU' at line 11<br /><br /><pre>CREATE TABLE ps_wallet (
id INT NOT NULL,
id_customer INT NOT NULL,
cash INT DEFAULT 0,
data_add DATETIME DEFAULT CURRENT_TIMESTAMP,
data_upd DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
FOREIGN KEY (id_customer) REFERENCES ps_customer(id_customer)
);
CREATE TABLE ps_wallet_history (
id INT NOT NULL,
id_customer INT NOT NULL,
id_wallet INT NOT NULL,
last_amount INT NOT NULL,
Summary TEXT(255) NOT NULL,
data_add DATETIME DEFAULT CURRENT_TIMESTAMP,
data_upd DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
FOREIGN KEY (id_customer) REFERENCES ps_customer(id_customer),
FOREIGN KEY (id_wallet) REFERENCES ps_wallet(id)
);</pre>
I took all ` for the exam, but there was no result.
Thanks for the help.
2
Answers
Thanks for the help It worked correctly when I ran it individually.
install.sql file :
) ENGINE = INNODB COLLATE utf8_general_ci;
historyTable File :
) ENGINE = INNODB COLLATE utf8_general_ci;
The ps_customer table must be created first, use this code and see if it solves your problem: