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

ability mapping model's field to different column name #124

Open
toghrulgasimov opened this issue Dec 21, 2021 · 5 comments
Open

ability mapping model's field to different column name #124

toghrulgasimov opened this issue Dec 21, 2021 · 5 comments

Comments

@toghrulgasimov
Copy link

is there a way to change column name of model in database?

@Clonkk
Copy link
Contributor

Clonkk commented Dec 21, 2021

Out of curiosity, what would be the point of that ?

@moigagoo
Copy link
Owner

Out of curiosity, what would be the point of that ?

Probably connecting Norm to an existing table.

This can be implemented in a similar manner to tableName pragma: #123

@PhilippMDoerner
Copy link
Collaborator

Probably connecting Norm to an existing table.

I can fully confirm that this would be the usecase, at least for me.
In my case, I've got a table generated from another framework from which I'm rewriting the backend. That gave me lots of columns with an _id suffix.
Currently I'm writing my models in a way that I have an entire instance of a Campaign object sitting behind a fieldName of campaign_id, which is a somewhat confusing read for somebody uninitiated.

@saemideluxe
Copy link

Same here. If Norm had more support for using existing databases, I would definitely consider to use it in many more places.

@moigagoo
Copy link
Owner

moigagoo commented Jun 4, 2022

I'll take a look at this. Shouldn't be too hard.

However, custom primary keys have higher priority to me.

@moigagoo moigagoo added this to Norm Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

5 participants