Git Product home page Git Product logo

Comments (7)

ofbeaton avatar ofbeaton commented on May 31, 2024 3

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.

tonivj5 avatar tonivj5 commented on May 31, 2024 1

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.

ofbeaton avatar ofbeaton commented on May 31, 2024

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.

qathom avatar qathom commented on May 31, 2024

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.

tonivj5 avatar tonivj5 commented on May 31, 2024

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.

tonivj5 avatar tonivj5 commented on May 31, 2024

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.

tonivj5 avatar tonivj5 commented on May 31, 2024

Hey @ofbeaton, @sanderlissenburg has fixed (:cupid:) this "doc missing" :+1:

from typeorm-naming-strategies.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.