luizdamim
Change table name (source) to uppercase on MySQL/MariaDB
Is it possible to change the table name (source) of an Ecto schema based on the Repo or the Adapter?
I need to connect to two databases, a PostgreSQL and a MySQL.
Tables on the MySQL server were created with uppercase names, so for example when querying all users, the generated SQL (SELECT ... FROM `users`) works on PostgreSQL but gives an error on MySQL as the table doesn’t exist, it exists as USERS.
Both are beyond my control, I don’t have permission to change either config. If I had access to the database I could change the config allowing case insensivity (https://dev.mysql.com/doc/refman/5.7/en/identifier-case-sensitivity.html).
Marked As Solved
benwilson512
You can from u in {"users", User} and from u in {"USERS", User} where the first item is the table name and the second is the schema to cast to.







