Comments (7)
I just added:
const SnakeNamingStrategy = require('typeorm-naming-strategies').SnakeNamingStrategy
const snakeNamingStrategy = new SnakeNamingStrategy();
To the top of my ormconfig.js
, which I believe is picked up by the CLI as well.
I also import my dotenv
in it so it actually has no secrets/config in it, and it's all pulled from environment variables, and the ormconfig.js
can be checked into VCS.
Wether or not this functionality should be part of typeorm...
How to correctly use this package so that it works with typeorm projects is not a typeorm issue, and this package should clearly explain how you can use it. No-one should have to go into the issues list to find out how to use this package.
from typeorm-naming-strategies.
Hey @qathom, glad to hear someone else is using this module 🎉
To use it into migrations, you must import it too. See this issue where explain how to do it typeorm/typeorm#1482 (comment) or this one typeorm/typeorm#2200 (comment)
I hope this works for you 👍
from typeorm-naming-strategies.
I came here looking for a solution to this problem as well. Perhaps the proper solution would be to update this modules usage documentation to cover this? I also expected it to cover this.
from typeorm-naming-strategies.
Hi @tonivj5
Thanks for your prompt reply!
This module should be an official option in typeorm because case sensitivity can be an issue (at least for tables) :-)
I understand that we have to import this module - sadly I'm using the typeorm CLI directly so this means that I would need to setup a "wrapper" or as you suggested, use a js config file.
Currently, I'm loading the config from a dotenv file (.env
).
from typeorm-naming-strategies.
Perhaps the proper solution would be to update this modules usage documentation to cover this?
PR are welcome! 🎉 However, it's an "issue" of typeorm properly
This module should be an official option in typeorm because case sensitivity can be an issue (at least for tables) :-)
Totally! That was the reason because I created it primarily 👍
I understand that we have to import this module - sadly I'm using the typeorm CLI directly so this means that I would need to setup a "wrapper" or as you suggested, use a js config file.
typeorm cli has a --config
, I think you could use it to point to a .js
config where the naming strategy is imported...
Anyway, it's a typeorm's issue 😞
from typeorm-naming-strategies.
Thanks for the tip @ofbeaton
How to correctly use this package so that it works with typeorm projects is not a typeorm issue, and this package should clearly explain how you can use it. No-one should have to go into the issues list to find out how to use this package.
If typeorm hasn't documeneted how to use custom naming strategies in migrations, I think it's a typeorm's lack. This package only implements its interface.
Anyway, you can create a PR to document it if you want, they're very welcome ❤️
from typeorm-naming-strategies.
Hey @ofbeaton, @sanderlissenburg has fixed (:cupid:) this "doc missing" :+1:
from typeorm-naming-strategies.
Related Issues (16)
- Foreign key naming HOT 7
- How to avoid naming change ? HOT 1
- MongoDB integration HOT 2
- Potential Duplicate Package Name HOT 2
- TypeORM module resolution issue after 0.2.42 HOT 2
- problem with StringUtils HOT 6
- Error when using a ncc build with "typeorm-naming-strategies" HOT 1
- Typeorm v0.3.3 support HOT 1
- Using `JoinTable` with `name` causes SQLITE_ERROR
- Duplicate underscore in oneToMany HOT 2
- I am getting this issue on npm run start
- Alias replacement not taking account multiple lines
- Naming strategy doesn't applied to query builder return value HOT 1
- Is this project maintained? HOT 1
- TypeError: namingStrategy.tableName is not a function HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typeorm-naming-strategies.