typeorm / typeorm

ORM for TypeScript and JavaScript. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
http://typeorm.io
MIT License
34.22k stars 6.31k forks source link

Tablename Uppercase not possible #4420

Open feihan opened 5 years ago

feihan commented 5 years ago

Issue type:

[ ] question [x] bug report [ ] feature request [ ] documentation issue

Database system/driver:

[ ] cordova [ ] mongodb [ ] mssql [x] mysql / mariadb [ ] oracle [ ] postgres [ ] cockroachdb [ ] sqlite [ ] sqljs [ ] react-native [ ] expo

TypeORM version:

[x] latest [ ] @next [ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

When i add @Entity('TableName), it does create the table as "tablename" and if i turn on synchronize, it says "tablename" already exists - but doesnt synchronize it. This just works if i name it @Entity('tablename'). But i'd like to name my tables in camelcase, and still use synchronize on it.

In this case, there was some suggestion about allowing custom cases: https://github.com/typeorm/typeorm/issues/458

Thank you

greg-hoarau commented 5 years ago

Probably the same issue #2782

vahidvdn commented 3 years ago

I think this has nothing to do with typeorm. Mysql doesn't allow to have a table name with an uppercase letter (at least in newer versions).

haishangfeng commented 3 years ago

确实是,因为这个数据表有大写字母的原因。

ewrfedf commented 3 years ago

"strictNullChecks": false,

remove this in tsconfig.js

RobertCharron commented 3 years ago

I am still experiencing this issue. In order to get around this issue, I had to put the class to lower case. Even doing @Entity('user') and @Entity({name: 'user', schema: 'public'}) both failed.

This is a little disappointing, and I'm glad others have found solutions that work for them but I am unable to do so.

m-salman-afzal commented 2 years ago

The real error is when we try to synchronize, typeorm tries to create the table instead of doing, create table if not exists. They just need to change their internal query. Because Sequelize and other ORMs do things the right way. If not for my team lead, I would have left typeorm a long time.

vikaskandari commented 1 year ago

Same Issue - when creating a table name with capital letters typeorm with sync on it checks the schema with lower case and tries to create it with upper case.