Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@zdhsoft/tmg
Advanced tools
Readme
Generates models for TypeORM from existing databases. Supported db engines:
Typeorm-model-generator comes with preinstalled driver for each supported db(except for oracle). However if you want to use it as a dev-dependency you may want to install your db driver manually to reduce dependency footprint, reduce time spent in the CI. In such case you can use version without preinstalled db drivers - npm i @zdhsoft@tmg@no-engines
.
To install module globally simply type npm i -g @zdhsoft/tmg
in your console.
Thanks to npx you can use npm modules without polluting global installs. So nothing to do here :)
To use
npx
you need to use npm at version at least 5.2.0. Try updating your npm bynpm i -g npm
All database drivers except oracle are installed by default. To use typeorm-model-generator with oracle database you need to install driver with npm i oracledb
and configure oracle install client on your machine.
There are two way to use this utility:
npx tmg
in your console.Use npx tmg --help
to see all available parameters with their descriptions. Some basic parameters below:
Usage: tmg -h <host> -d <database> -p [port] -u <user> -x [password] -e [engine]
You can also run program without specifying any parameters.
选项:
--help 显示帮助信息 [布尔]
--version 显示版本号 [布尔]
-h, --host IP address/Hostname for database server [字符串] [默认值: "127.0.0.1"]
-d, --database Database name(or path for sqlite). You can pass multiple values separated by comma. [字符串] [必需] [默认值: ""]
-u, --user Username for database server [字符串] [默认值: ""]
-x, --pass Password for database server [字符串] [默认值: ""]
-p, --port Port number for database server [数字] [默认值: 0]
-e, --engine Database engine [必需] [可选值: "mssql", "postgres", "mysql", "mariadb", "oracle", "sqlite"]
-o, --output Where to place generated models [默认值: "./output"]
-s, --schema Schema name to create model from. Only for mssql and postgres. You can pass multiple values separated by comma eg. -s scheme1,scheme2,scheme3 [字符串] [默认值: ""]
-i, --instance Named instance to create model from. Only for mssql. [字符串]
--ssl [布尔] [默认值: false]
--noConfig Doesn't create tsconfig.json and ormconfig.json [布尔] [默认值: false]
--cf, --case-file Convert file names to specified case [可选值: "pascal", "param", "camel", "snake", "none"] [默认值: "pascal"]
--ce, --case-entity Convert class names to specified case [可选值: "pascal", "camel", "none"] [默认值: "pascal"]
--cp, --case-property Convert property names to specified case [可选值: "pascal", "camel", "snake", "none"] [默认值: "camel"]
--eol Force EOL to be LF or CRLF [可选值: "LF", "CRLF"] [默认值: "CRLF"]
--pv, --property-visibility Defines which visibility should have the generated property [可选值: "public", "protected", "private", "none"] [默认值: "none"]
--lazy Generate lazy relations[布尔] [默认值: false]
-a, --active-record Use ActiveRecord syntax for generated models [布尔] [默认值: false]
--namingStrategy Use custom naming strategy [字符串] [默认值: ""]
--relationIds Generate RelationId fields [布尔] [默认值: false]
--skipSchema Omits schema identifier in generated entities [布尔] [默认值: false]
--generateConstructor Generate constructor allowing partial initialization [布尔] [默认值: false]
--disablePluralization Disable pluralization of OneToMany, ManyToMany relation names [布尔] [默认值: false]
--skipTables Skip schema generation for specific tables. You can pass multiple values separated by comma [字符串] [默认值: ""]
--tables Generate specific tables. You can pass multiple values separated by comma [字符串] [默认值: ""]
--strictMode Mark fields as optional(?) or non-null(!) [可选值: "none", "?", "!"] [默认值: "none"]
--index Generate index file [布尔] [默认值: false]
--defaultExport Generate index file [布尔] [默认值: false]
tmg -h localhost -d tempdb -u sa -x !Passw0rd -e mssql -o .
npx tmg -h localhost -d tempdb -u sa -x !Passw0rd -e mssql -o .
tmg -h localhost -d postgres -u postgres -x !Passw0rd -e postgres -o . -s public --ssl
npx tmg -h localhost -d postgres -u postgres -x !Passw0rd -e postgres -o . -s public --ssl
tmg -d "Z:\sqlite.db" -e sqlite -o .
npx tmg -d "Z:\sqlite.db" -e sqlite -o .
Please take a look at few workflows which might help you with deciding how you're gonna use typeorm-model-generator.
If you want to generate custom names for properties in generated entities you need to use custom naming strategy. You need to create your own version of NamingStrategy and pass it as command parameter.
tmg -d typeorm_mg --namingStrategy=./NamingStrategy -e sqlite -db /tmp/sqliteto.db
FAQs
这个是从https://github.com/Kononnable/typeorm-model-generator.git fork过来的项目,目的在于增加定制化的一些功能和要求
The npm package @zdhsoft/tmg receives a total of 0 weekly downloads. As such, @zdhsoft/tmg popularity was classified as not popular.
We found that @zdhsoft/tmg demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.