You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NOT NULL, PRIMARY KEY (`id`)'
if(!(isMariaDb&&column.asExpression)&&!column.isNullable)c+=" NOT NULL";if(!(isMariaDb&&column.asExpression)&&column.isNullable)c+=" NULL";
seems to work fine.
While the handling of VIRTUAL [NULL | NOT NULL] should probably need to be confirmed by mariaDb and documented, its current iteration doesn't allow it.
The text was updated successfully, but these errors were encountered:
* Fix MariaDB VIRTUAL [NOT NULL|NULL] error
Fixes#2691
query failed: ALTER TABLE `customer` CHANGE `fullName` `fullName` varchar(255) AS (CONCAT(`firstName`, ' ', `lastName`)) VIRTUAL NULL
error: Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1
* slightly change code style to improve readability
Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
Issue type:
[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]
mongodb
[ ]
mssql
[x]
mysql
/mariadb
[ ]
oracle
[ ]
postgres
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
[ ]
expo
TypeORM version:
[ ]
latest
[ ]
@next
[x]
0.2.7
(or put your version here)Steps to reproduce or a small repository showing the problem:
This more or less creates this schema:
The issue is https://github.com/typeorm/typeorm/blob/master/src/driver/mysql/MysqlQueryRunner.ts#L1500-L1503
adds the
[NULL | NOT NULL]
on a virtual column, which is fine in MySQL 5.7, but apparently not in mariaDB... I can't find anything hinting this in their documentation. Only Errors and articles saying so.https://mariadb.com/kb/en/library/generated-columns/
https://www.percona.com/blog/2016/03/04/virtual-columns-in-mysql-and-mariadb/
Adding a check to the lines I referred to above
seems to work fine.
While the handling of
VIRTUAL [NULL | NOT NULL]
should probably need to be confirmed by mariaDb and documented, its current iteration doesn't allow it.The text was updated successfully, but these errors were encountered: