feathers-plus / cli

FeathersJS CLI supporting both REST and GraphQL architectural concepts and their query languages.
https://generator.feathers-plus.com/
Other
43 stars 7 forks source link

SQL Syntax error with Sequelize, TS and MySQL 8 ? #27

Closed GhuronZhan closed 5 years ago

GhuronZhan commented 5 years ago

Hello,

If I do a temporary patch with as any on sequelize.ts -> https://github.com/feathers-plus/cli/issues/26 , the node server is "near launched" BUT there is a issue with SQL. Is this linked to Typescript version ? feathers-sequelize or mysql 2 and MySQL 8 ? I've tried to find answers in vain...

Steps to reproduce

services: db: image: mysql:8.0.3 container_name: dev_mysql_8 environment:

Steps to reproduce

Expected behavior

Tell us what should happen

Actual behavior

Tell us what happens instead

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

NodeJS version:

Operating System:

Browser Version:

React Native Version:

Module Loader:

Expected behavior

Just want to start the Feathers app for the moment...

Actual behavior

Throw an error after npm run dev command :

benoit@PC-SD-01:~/projects/test_fia$ npm run dev

> test-fia@0.0.0 dev /home/benoit/projects/test_fia
> nodemon src/index.ts

[nodemon] 1.18.9
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: tsconfig.json tslint.json src/**/*.ts
[nodemon] starting `ts-node --files --typeCheck src/index.ts`
info: Feathers application started on http://localhost:3030
error: Unhandled Rejection at: Promise  {"_bitField":18087936,"_fulfillmentHandler0":{"name":"SequelizeDatabaseError","parent":{"code":"ER_PARSE_ERROR","errno":1064,"sqlState":"42000","sqlMessage":"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 'JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PR' at line 1","sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"},"original":{"code":"ER_PARSE_ERROR","errno":1064,"sqlState":"42000","sqlMessage":"You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PR' at line 1","sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"},"sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`))ENGINE=InnoDB;"},"_trace":{"_promisesCreated":0,"_length":1},"meta":[{"isFulfilled":false,"isRejected":true,"rejectionReason":{"name":"SequelizeDatabaseError","parent":{"code":"ER_PARSE_ERROR","errno":1064,"sqlState":"42000","sqlMessage":"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 'JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PR' at line 1","sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"},"original":{"code":"ER_PARSE_ERROR","errno":1064,"sqlState":"42000","sqlMessage":"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 'JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PR' at line 1","sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"},"sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"}},{"name":"SequelizeDatabaseError","parent":{"code":"ER_PARSE_ERROR","errno":1064,"sqlState":"42000","sqlMessage":"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 'JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PR' at line 1","sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARYKEY (`id`)) ENGINE=InnoDB;"},"original":{"code":"ER_PARSE_ERROR","errno":1064,"sqlState":"42000","sqlMessage":"You have an error in your SQL syntax; check the manual that corresponds to your MySQLserver version for the right syntax to use near 'JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PR' at line 1","sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"},"sql":"CREATE TABLE IF NOT EXISTS `teams` (`id` INTEGER auto_increment , `name` TEXT NOT NULL, `members` JSONB NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"}]}

System configuration

Module versions :

"dependencies": {
    "@feathers-plus/test-utils": "^0.3.5",
    "@feathersjs/authentication": "^2.1.15",
    "@feathersjs/authentication-jwt": "^2.0.9",
    "@feathersjs/authentication-local": "^1.2.9",
    "@feathersjs/configuration": "^2.0.6",
    "@feathersjs/errors": "^3.3.6",
    "@feathersjs/express": "^1.3.1",
    "@feathersjs/feathers": "^3.3.1",
    "@feathersjs/socketio": "^3.2.9",
    "ajv": "^5.5.2",
    "compression": "^1.7.3",
    "cors": "^2.8.5",
    "cross-env": "^5.2.0",
    "feathers-hooks-common": "^4.20.2",
    "feathers-sequelize": "^3.1.3",
    "helmet": "^3.15.0",
    "lodash.merge": "^4.6.1",
    "mysql2": "^1.6.4",
    "sequelize": "^4.42.0",
    "serve-favicon": "^2.5.0",
    "winston": "^3.1.0"
  },
  "devDependencies": {
    "@types/compression": "0.0.36",
    "@types/cors": "^2.8.4",
    "@types/feathersjs__authentication": "^2.1.2",
    "@types/feathersjs__authentication-jwt": "^1.0.5",
    "@types/feathersjs__authentication-local": "^1.0.3",
    "@types/feathersjs__configuration": "^1.0.1",
    "@types/feathersjs__errors": "^3.2.1",
    "@types/feathersjs__express": "^1.1.4",
    "@types/feathersjs__feathers": "^3.1.1",
    "@types/feathersjs__socketio": "^3.0.3",
    "@types/helmet": "0.0.40",
    "@types/lodash.merge": "^4.6.4",
    "@types/mocha": "^5.2.5",
    "@types/request-promise": "^4.1.42",
    "@types/sequelize": "^4.27.34",
    "@types/serve-favicon": "^2.2.30",
    "@types/winston": "^2.4.4",
    "mocha": "^5.2.0",
    "nodemon": "^1.18.9",
    "request": "^2.88.0",
    "request-promise": "^4.2.2",
    "ts-mocha": "^2.0.0",
    "ts-node": "^7.0.1",
    "tslint": "^5.12.1",
    "typescript": "^3.2.4"
  }

Node version: 10.15.0

NPM Version: 6.4.1

Feathers-Plus Version: 0.7.75

MySQL Version: 8.0.3 (as you can see in docker-compose.yml)

Operating System: Ubuntu 18.04.1 LTS