Reputation: 1437
I have a database which is already quite big, and I need to access the tables and the columns the way they have been written THERE (camelCase). Can I change the following code to make it possible to access camelCase, or at least a way to define a String as it is in my database, for each table and column?
share [mkPersist sqlSettings, mkMigrate "migrateAll"]
$(persistFileWith lowerCaseSettings "config/models")
Another thing: I don't want to do any migration, I want just to do the CRUD
Example
Model:
MyTest
firstName Text
Table:
create table MyTest (
id int unsigned AUTO_INCREMENT,
firstName varchar (255) not null,
primary key(id)
)
Another thing: What if I have a column called myColumn2 and I want it to be myColumn in the definition? How could I define a custom name to be used while talking to the DB?
Upvotes: 0
Views: 133
Reputation: 3285
Look at this page in the docs: https://hackage.haskell.org/package/persistent-2.2.2/docs/Database-Persist-Quasi.html
The field named psToDBName can be set to give you the behavior you are looking for. I'm on a phone right now, but I'll try to give an example later when I get back to a computer.
Upvotes: 1