db-migrate / db-migrate/english-docs

Error when execute sql

Open
#40 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
17
Forks
45
PR merge metrics
No merged PRs in 30d

Description

Hi,
I created migration via sql script for my ups i have this
`CREATE TABLE `messages` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`userIDFrom` int(11) NOT NULL,
`userIDTo` int(11) NOT NULL,
`content` text NOT NULL,
`roomId` int(11) NOT NULL DEFAULT '0',
`created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE `rooms` (
`roomId` int(11) NOT NULL AUTO_INCREMENT,
`roomName` varchar(50) DEFAULT NULL,
`creatorId` int(11) DEFAULT NULL,
`created_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`roomId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;`

In my down sql i have this
`drop table messages
drop table rooms`

then for my database connection
` "prod": {
"host": "localhost",
"user": "maldito" ,
"password" : "balba2018!" ,
"database": "chatdb",
"port":"3306",
"driver": "mysql"
},
`
when running this code i got an error
db-migrate up --config config/database.json -e prod

[ERROR] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: ER_PARSE_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 `rooms` (
`roomId` int(11) NOT NULL AUTO_INCREMENT,

then I try to remove then last sql it run perfectly

---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/84203883-error-when-execute-sql?utm_campaign=plugin&utm_content=tracker%2F11704504&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F11704504&utm_medium=issues&utm_source=github).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.