Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeORM is modifying the case of table names and removing underscores from them when running an INSERT-type migration #10807

Open
1 of 18 tasks
Juansecu opened this issue Mar 30, 2024 · 2 comments

Comments

@Juansecu
Copy link

Juansecu commented Mar 30, 2024

Issue description

I'm trying to insert data in a table with name Role_permissions from a TypeORM migration, but when I execute it, I get the message database_name.rolepermissions' doesn't exist.

Expected Behavior

I would expect a behavior of not changing the database name at all, since it makes an exception to be throwed.

Actual Behavior

TypeORM is modifying the case of the table name Role_permissions and removing underscores representing spaces, which causes the database engine to throw an error while trying to insert the data in the given table.

To be more specific, the table that TypeORM points to after doing the mentioned modifications in the table name is rolepermissions.

Steps to reproduce

  1. Create a table with the name Role_permissions in a MySQL database, with the columns Role_id and Permission_id.
  2. Create a migration to insert data in the table Role_permissions.
  3. TypeORM will throw an error explaining the table rolepermissions does not exist.

My Environment

Dependency Version
Operating System Windows
Node.js version 20.11.1
Typescript version 4.9.5
TypeORM version 0.3.20
Nest.js version 9.4.3

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

Yes, I have the time, but I don't know how to start. I would need guidance.

@pedro-santos21
Copy link

Does the error still happen if you insert "underline" using unicode?

Here's a guide

@Juansecu
Copy link
Author

Juansecu commented Apr 4, 2024

Yes, it fixes my issue. Thank you so much for the help, @pedro-santos21!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants